diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2018-01-15 21:47:32 -0500 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2018-01-15 22:09:01 -0500 |
commit | 115fe0d7fe537a3069ba2051942c2f3333d0baa5 (patch) | |
tree | e81daabd17d46c68a645079c251e499e1d8c3191 /projects/ich9gen/sources/src/descriptor | |
parent | b2321c6f7be6e0d9fe1e9ef01427f353a0eb55a7 (diff) | |
download | librebootfr-115fe0d7fe537a3069ba2051942c2f3333d0baa5.tar.gz librebootfr-115fe0d7fe537a3069ba2051942c2f3333d0baa5.zip |
Delete trailing whitespace from ich9gen & co.
Diffstat (limited to 'projects/ich9gen/sources/src/descriptor')
-rw-r--r-- | projects/ich9gen/sources/src/descriptor/descriptor.c | 94 | ||||
-rw-r--r-- | projects/ich9gen/sources/src/descriptor/descriptor.h | 44 |
2 files changed, 69 insertions, 69 deletions
diff --git a/projects/ich9gen/sources/src/descriptor/descriptor.c b/projects/ich9gen/sources/src/descriptor/descriptor.c index 18e4e17a..61ced67e 100644 --- a/projects/ich9gen/sources/src/descriptor/descriptor.c +++ b/projects/ich9gen/sources/src/descriptor/descriptor.c @@ -1,9 +1,9 @@ /* * descriptor/descriptor.c * This file is part of the ich9deblob utility from the libreboot project - * + * * Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org> - * Copyright (C) 2014 Steve Shenton <sgsit@libreboot.org> + * Copyright (C) 2014 Steve Shenton <sgsit@libreboot.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 @@ -32,7 +32,7 @@ * --------------------------------------------------------------------- */ -/* Set the Host CPU / BIOS region to have read-write access on all regions */ +/* Set the Host CPU / BIOS region to have read-write access on all regions */ struct DESCRIPTORREGIONRECORD descriptorHostRegionsUnlocked(struct DESCRIPTORREGIONRECORD descriptorStruct) { descriptorStruct.masterAccessSection.flMstr1.fdRegionReadAccess = 0x1; @@ -80,7 +80,7 @@ struct DESCRIPTORREGIONRECORD descriptorPlatformRegionRemoved(struct DESCRIPTORR { descriptorStruct.regionSection.flReg4.BASE = 0x1FFF; descriptorStruct.regionSection.flReg4.LIMIT = 0; - + return descriptorStruct; } @@ -89,7 +89,7 @@ struct DESCRIPTORREGIONRECORD descriptorDisableMe(struct DESCRIPTORREGIONRECORD { descriptorStruct.ichStraps.ichStrap0.meDisable = 1; descriptorStruct.mchStraps.mchStrap0.meDisable = 1; - + return descriptorStruct; } @@ -97,7 +97,7 @@ struct DESCRIPTORREGIONRECORD descriptorDisableMe(struct DESCRIPTORREGIONRECORD struct DESCRIPTORREGIONRECORD descriptorDisableTpm(struct DESCRIPTORREGIONRECORD descriptorStruct) { descriptorStruct.mchStraps.mchStrap0.tpmDisable = 1; - + return descriptorStruct; } @@ -106,7 +106,7 @@ struct DESCRIPTORREGIONRECORD descriptorMoveGbeToStart(struct DESCRIPTORREGIONRE { descriptorStruct.regionSection.flReg3.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT; descriptorStruct.regionSection.flReg3.LIMIT = GBEREGIONSIZE_8K >> FLREGIONBITSHIFT; - + return descriptorStruct; } @@ -115,7 +115,7 @@ struct DESCRIPTORREGIONRECORD descriptorGbeRegionRemoved(struct DESCRIPTORREGION { descriptorStruct.regionSection.flReg3.BASE = 0x1FFF; descriptorStruct.regionSection.flReg3.LIMIT = 0; - + return descriptorStruct; } @@ -124,7 +124,7 @@ struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterGbe(struct DESCR { descriptorStruct.regionSection.flReg1.BASE = (DESCRIPTORREGIONSIZE + GBEREGIONSIZE_8K) >> FLREGIONBITSHIFT; descriptorStruct.regionSection.flReg1.LIMIT = (romSize >> FLREGIONBITSHIFT) - 1; - + return descriptorStruct; } @@ -133,7 +133,7 @@ struct DESCRIPTORREGIONRECORD descriptorBiosRegionFillImageAfterDescriptor(struc { descriptorStruct.regionSection.flReg1.BASE = DESCRIPTORREGIONSIZE >> FLREGIONBITSHIFT; descriptorStruct.regionSection.flReg1.LIMIT = (romSize >> FLREGIONBITSHIFT) - 1; - + return descriptorStruct; } @@ -150,7 +150,7 @@ struct DESCRIPTORREGIONRECORD descriptorOemString(struct DESCRIPTORREGIONRECORD 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 */ @@ -178,7 +178,7 @@ struct DESCRIPTORREGIONRECORD librebootSetGbeBiosDescriptorRegions(struct DESCRI { 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) */ @@ -193,7 +193,7 @@ struct DESCRIPTORREGIONRECORD librebootSetGbeBiosDescriptorRegions(struct DESCRI 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) */ @@ -237,12 +237,12 @@ struct DESCRIPTORREGIONRECORD librebootDescriptorStructFromFactory(struct DESCRI 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; } @@ -254,64 +254,64 @@ struct DESCRIPTORREGIONRECORD librebootDescriptorStructFromFactory(struct DESCRI /* * Generate a C (.h) header file for the C source file made by notCreatedCFileFromDescriptorStruct() - * + * * Output it to a file. */ -int notCreatedHFileForDescriptorCFile(char* outFileName, char* cFileName) -{ +int notCreatedHFileForDescriptorCFile(char* outFileName, char* cFileName) +{ remove(outFileName); /* Remove the old file before continuing */ - + /* Open the file that will be written to */ FILE* fp = fopen(outFileName, "w+"); /* ------------------------------ */ - + fprintf(fp, "/* %s: generated C code from ich9deblob */\n", outFileName); fprintf(fp, "/* .h header file for the descriptor-generating C code (%s) */\n\n", cFileName); - + fprintf(fp, "#ifndef ICH9GEN_MKDESCRIPTOR_H\n"); fprintf(fp, "#define ICH9GEN_MKDESCRIPTOR_H\n\n"); - + fprintf(fp, "#include <stdio.h>\n"); fprintf(fp, "#include <string.h>\n"); fprintf(fp, "#include \"../descriptor/descriptor.h\"\n\n"); - + fprintf(fp, "struct DESCRIPTORREGIONRECORD generatedDescriptorStruct(unsigned int romSize, int hasGbe);\n"); - + fprintf(fp, "#endif\n"); - + /* ------------------------------ */ - + fclose(fp); /* Always close the file when done. */ - + return 0; } /* * Generate a C source file that initializes the same data from a given * 4KiB Descriptor data structure. - * + * * Output it to a file. */ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptorStruct, char* outFileName, char* headerFileName) { int i, j; - + remove(outFileName); /* Remove the old file before continuing */ - + /* Open the file that will be written to */ FILE* fp = fopen(outFileName, "w+"); /* ------------------------------ */ - + fprintf(fp, "/* %s: generated C code from ich9deblob */\n", outFileName); fprintf(fp, "/* .c source file for the descriptor-generating C code */\n\n"); - + fprintf(fp, "#include \"%s\"\n\n", headerFileName); - + 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, int hasGbe)\n"); fprintf(fp, "{\n"); fprintf(fp, " int i;\n"); @@ -600,11 +600,11 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor fprintf(fp, "\n"); fprintf(fp, " return descriptorStruct;\n"); fprintf(fp, "}\n\n"); - + /* ------------------------------ */ - + fclose(fp); /* Always close the file when done. */ - + return 0; } @@ -620,7 +620,7 @@ int notCreatedCFileFromDescriptorStruct(struct DESCRIPTORREGIONRECORD descriptor void printDescriptorRegionLocations(struct DESCRIPTORREGIONRECORD descriptorStruct, char* romName) { printf("\n"); - + /* Descriptor region */ printf( "%s: Descriptor start block: %08x ; Descriptor end block: %08x\n", @@ -628,23 +628,23 @@ void printDescriptorRegionLocations(struct DESCRIPTORREGIONRECORD descriptorStru descriptorStruct.regionSection.flReg0.BASE << FLREGIONBITSHIFT, descriptorStruct.regionSection.flReg0.LIMIT << FLREGIONBITSHIFT ); - + /* BIOS region */ printf( - "%s: BIOS start block: %08x ; BIOS end block: %08x\n", + "%s: BIOS start block: %08x ; BIOS end block: %08x\n", romName, - descriptorStruct.regionSection.flReg1.BASE << FLREGIONBITSHIFT, + descriptorStruct.regionSection.flReg1.BASE << FLREGIONBITSHIFT, descriptorStruct.regionSection.flReg1.LIMIT << FLREGIONBITSHIFT ); - + /* ME region */ printf( - "%s: ME start block: %08x ; ME end block: %08x\n", + "%s: ME start block: %08x ; ME end block: %08x\n", romName, - descriptorStruct.regionSection.flReg2.BASE << FLREGIONBITSHIFT, + descriptorStruct.regionSection.flReg2.BASE << FLREGIONBITSHIFT, descriptorStruct.regionSection.flReg2.LIMIT << FLREGIONBITSHIFT ); - + /* GBe region */ printf( "%s: GBe start block: %08x ; GBe end block: %08x\n", @@ -652,7 +652,7 @@ void printDescriptorRegionLocations(struct DESCRIPTORREGIONRECORD descriptorStru descriptorStruct.regionSection.flReg3.BASE << FLREGIONBITSHIFT, descriptorStruct.regionSection.flReg3.LIMIT << FLREGIONBITSHIFT ); - + /* Platform region */ printf( "%s: Platform start block: %08x ; Platform end block: %08x\n", @@ -660,6 +660,6 @@ void printDescriptorRegionLocations(struct DESCRIPTORREGIONRECORD descriptorStru descriptorStruct.regionSection.flReg4.BASE << FLREGIONBITSHIFT, descriptorStruct.regionSection.flReg4.LIMIT << FLREGIONBITSHIFT ); - + return; } diff --git a/projects/ich9gen/sources/src/descriptor/descriptor.h b/projects/ich9gen/sources/src/descriptor/descriptor.h index 7fb5c257..c81d451f 100644 --- a/projects/ich9gen/sources/src/descriptor/descriptor.h +++ b/projects/ich9gen/sources/src/descriptor/descriptor.h @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ - + /* * Purpose: provide struct representing descriptor region. * Map actual buffers of this regions, directly to instances of these @@ -27,10 +27,10 @@ * bit fields used, corresponding to datasheet. See links to datasheets * and documentation in ich9deblob.c */ - + /* * See docs/hardware/x200_remove_me.html for info plus links to datasheet (also linked below) - * + * * Info about flash descriptor (read page 845 onwards): * http://www.intel.co.uk/content/dam/doc/datasheet/io-controller-hub-9-datasheet.pdf */ @@ -54,7 +54,7 @@ #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 * To manipulate these easily in C, we shift them by FLREGIONBITSHIFT and then shift them back when done @@ -72,7 +72,7 @@ struct FLVALSIG { /* - * 4 bytes. + * 4 bytes. * descriptor mode = 0FF0A55A (hex, big endian). Note: stored in ROM in little endian order. * Anything else is considered invalid and will put the system in non-descriptor mode. */ @@ -92,7 +92,7 @@ struct FLMAP0 /* most significant bits. */ }; -struct FLMAP1 +struct FLMAP1 { /* least significant bits */ uint8_t FMBA : 8; @@ -103,7 +103,7 @@ struct FLMAP1 /* most significant bits */ }; -struct FLMAP2 +struct FLMAP2 { /* least significant bits */ uint8_t FMSBA : 8; @@ -113,7 +113,7 @@ struct FLMAP2 }; /* Flash Map Registers */ -struct FLMAPS +struct FLMAPS { struct FLMAP0 flMap0; struct FLMAP1 flMap1; @@ -121,7 +121,7 @@ struct FLMAPS }; /* Flash Components Register */ -struct FLCOMP +struct FLCOMP { /* least significant bits */ uint8_t component1Density : 3; @@ -138,7 +138,7 @@ struct FLCOMP /* most significant bits */ }; -struct COMPONENTSECTIONRECORD +struct COMPONENTSECTIONRECORD { struct FLCOMP flcomp; uint32_t flill; @@ -146,7 +146,7 @@ struct COMPONENTSECTIONRECORD uint8_t padding[36]; }; -struct FLREG +struct FLREG { /* least significant bits */ uint16_t BASE : 13; @@ -161,7 +161,7 @@ struct FLREG * Defines where all the regions begin/end. * This is very important for disabling ME/AMT */ -struct REGIONSECTIONRECORD +struct REGIONSECTIONRECORD { struct FLREG flReg0; /* Descriptor */ struct FLREG flReg1; /* BIOS */ @@ -171,7 +171,7 @@ struct REGIONSECTIONRECORD uint8_t padding[12]; }; -struct FLMSTR +struct FLMSTR { /* least significant bits */ uint16_t requesterId : 16; @@ -199,7 +199,7 @@ struct MASTERACCESSSECTIONRECORD uint8_t padding[148]; }; -struct ICHSTRAP0 +struct ICHSTRAP0 { /* least significant bits */ /* todo: add MeSmBus2Sel (boring setting) */ @@ -218,7 +218,7 @@ struct ICHSTRAP0 /* most significant bits */ }; -struct ICHSTRAP1 +struct ICHSTRAP1 { /* least significant bits */ uint8_t northMlink : 1; /* North MLink Dynamic Clock Gate Disable : Sets the default value for the South MLink Dynamic Clock Gate Enable registers. */ @@ -233,14 +233,14 @@ struct ICHSTRAP1 }; /* ICH straps */ -struct ICHSTRAPSRECORD +struct ICHSTRAPSRECORD { struct ICHSTRAP0 ichStrap0; struct ICHSTRAP1 ichStrap1; uint8_t padding[248]; }; -struct MCHSTRAP0 +struct MCHSTRAP0 { /* least significant bits */ uint8_t meDisable : 1; /* If true, ME is disabled. */ @@ -255,14 +255,14 @@ struct MCHSTRAP0 }; /* MCH straps */ -struct MCHSTRAPSRECORD +struct MCHSTRAPSRECORD { struct MCHSTRAP0 mchStrap0; uint8_t padding[3292]; }; /* ME VSCC Table */ -struct MEVSCCTABLERECORD +struct MEVSCCTABLERECORD { uint32_t jid0; uint32_t vscc0; @@ -284,14 +284,14 @@ struct DESCRIPTORMAP2RECORD }; /* OEM section */ -struct OEMSECTIONRECORD +struct OEMSECTIONRECORD { uint8_t magicString[8]; uint8_t padding[248]; }; /* 4KiB descriptor region, goes at the beginning of the ROM image */ -struct DESCRIPTORREGIONRECORD +struct DESCRIPTORREGIONRECORD { struct FLVALSIG flValSig; /* Flash Valid Signature Register */ struct FLMAPS flMaps; /* Flash Map Registers */ @@ -310,7 +310,7 @@ struct DESCRIPTORREGIONRECORD * Function declarations (keep gcc/make happy. check them in descriptor.c) * --------------------------------------------------------------------- */ - + struct DESCRIPTORREGIONRECORD descriptorHostRegionsUnlocked(struct DESCRIPTORREGIONRECORD descriptorStruct); struct DESCRIPTORREGIONRECORD descriptorMeRegionsForbidden(struct DESCRIPTORREGIONRECORD descriptorStruct); struct DESCRIPTORREGIONRECORD descriptorMeRegionRemoved(struct DESCRIPTORREGIONRECORD descriptorStruct); |