Silicon/Intel/Tools/FitGen/FitGen.c | 68 ++++++++++++++++++++ 1 file changed, 68 insertions(+)
From: "Agrawal, Sachin" <sachin.agrawal@intel.com>
REF https://bugzilla.tianocore.org/show_bug.cgi?id=2200
FitGen Tool is responsible for creating FIT table in UEFI BIOS.
A new FIT entry type (FIT Type 0x3) has been allocated for Diagnsotics ACM.
FitGen tool is updated to add support for this Diagnostics ACM.
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
---
Silicon/Intel/Tools/FitGen/FitGen.c | 68 ++++++++++++++++++++
1 file changed, 68 insertions(+)
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index 833610f2a0..48fbe1ef85 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -217,6 +217,7 @@ typedef struct {
#define FIT_TABLE_TYPE_HEADER 0
#define FIT_TABLE_TYPE_MICROCODE 1
#define FIT_TABLE_TYPE_STARTUP_ACM 2
+#define FIT_TABLE_TYPE_DIAGNST_ACM 3
#define FIT_TABLE_TYPE_BIOS_MODULE 7
#define FIT_TABLE_TYPE_TPM_POLICY 8
#define FIT_TABLE_TYPE_BIOS_POLICY 9
@@ -246,6 +247,8 @@ typedef struct {
UINT32 FitHeaderVersion;
FIT_TABLE_CONTEXT_ENTRY StartupAcm;
UINT32 StartupAcmVersion;
+ FIT_TABLE_CONTEXT_ENTRY DiagnstAcm;
+ UINT32 DiagnstAcmVersion;
FIT_TABLE_CONTEXT_ENTRY BiosModule[MAX_BIOS_MODULE_ENTRY];
UINT32 BiosModuleVersion;
FIT_TABLE_CONTEXT_ENTRY Microcode[MAX_MICROCODE_ENTRY];
@@ -318,6 +321,7 @@ Returns:
"\t[-L <MicrocodeSlotSize> <MicrocodeFfsGuid>]\n"
"\t[-I <BiosInfoGuid>]\n"
"\t[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>] [-V <StartupAcmVersion>]\n"
+ "\t[-U <DiagnstAcmAddress>|<DiagnstAcmGuid>]\n"
"\t[-B <BiosModuleAddress BiosModuleSize>] [-B ...] [-V <BiosModuleVersion>]\n"
"\t[-M <MicrocodeAddress MicrocodeSize>] [-M ...]|[-U <MicrocodeFv MicrocodeBase>|<MicrocodeRegionOffset MicrocodeRegionSize>|<MicrocodeGuid>] [-V <MicrocodeVersion>]\n"
"\t[-O RecordType <RecordDataAddress RecordDataSize>|<RESERVE RecordDataSize>|<RecordDataGuid>|<RecordBinFile> [-V <RecordVersion>]] [-O ... [-V ...]]\n"
@@ -332,6 +336,8 @@ Returns:
printf ("\tStartupAcmAddress - Address of StartupAcm.\n");
printf ("\tStartupAcmSize - Size of StartupAcm.\n");
printf ("\tStartupAcmGuid - Guid of StartupAcm Module, if StartupAcm is in a BiosModule, it will be excluded form that.\n");
+ printf ("\tDiagnstAcmAddress - Address of DiagnstAcm.\n");
+ printf ("\tDiagnstAcmGuid - Guid of DiagnstAcm Module, if DiagnstAcm is in a BiosModule, it will be excluded from that.\n");
printf ("\tBiosModuleAddress - Address of BiosModule. User should ensure there is no overlap.\n");
printf ("\tBiosModuleSize - Size of BiosModule.\n");
printf ("\tMicrocodeAddress - Address of Microcode.\n");
@@ -990,6 +996,17 @@ Returns:
gFitTableContext.StartupAcmVersion = BiosInfoStruct[BiosInfoIndex].Version;
gFitTableContext.FitEntryNumber ++;
break;
+ case FIT_TABLE_TYPE_DIAGNST_ACM:
+ if (gFitTableContext.DiagnstAcm.Type != 0) {
+ Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated DiagnosticsAcm!", NULL);
+ return 0;
+ }
+ gFitTableContext.DiagnstAcm.Type = FIT_TABLE_TYPE_DIAGNST_ACM;
+ gFitTableContext.DiagnstAcm.Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;
+ gFitTableContext.DiagnstAcm.Size = 0;
+ gFitTableContext.DiagnstAcmVersion = DEFAULT_FIT_ENTRY_VERSION;
+ gFitTableContext.FitEntryNumber ++;
+ break;
case FIT_TABLE_TYPE_BIOS_MODULE:
if ((BiosInfoStruct[BiosInfoIndex].Attributes & BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB) != 0) {
continue;
@@ -1223,6 +1240,40 @@ Returns:
} while (FALSE);
//
+ // 1.5. DiagnosticsAcm
+ //
+ do {
+ if ((Index + 1 >= argc) ||
+ ((strcmp (argv[Index], "-U") != 0) &&
+ (strcmp (argv[Index], "-u") != 0)) ) {
+ if (BiosInfoExist && (gFitTableContext.DiagnstAcm.Type == FIT_TABLE_TYPE_DIAGNST_ACM)) {
+ break;
+ }
+ break;
+ }
+ if (IsGuidData (argv[Index + 1], &Guid)) {
+ FileBuffer = FindFileFromFvByGuid (FdBuffer, FdSize, &Guid, &FileSize);
+ if (FileBuffer == NULL) {
+ Error (NULL, 0, 0, "-U Parameter incorrect, GUID not found!", "%s", argv[Index + 1]);
+ return 0;
+ }
+ FileBuffer = (UINT8 *)MEMORY_TO_FLASH (FileBuffer, FdBuffer, FdSize);
+ Index += 2;
+ } else {
+ FileBuffer = (UINT8 *) (UINTN) xtoi (argv[Index + 1]);
+ Index += 2;
+ }
+ if (gFitTableContext.DiagnstAcm.Type != 0) {
+ Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated DiagnosticsAcm!", NULL);
+ return 0;
+ }
+ gFitTableContext.DiagnstAcm.Type = FIT_TABLE_TYPE_DIAGNST_ACM;
+ gFitTableContext.DiagnstAcm.Address = (UINT32) (UINTN) FileBuffer;
+ gFitTableContext.DiagnstAcm.Size = 0;
+ gFitTableContext.FitEntryNumber ++;
+ gFitTableContext.DiagnstAcmVersion = DEFAULT_FIT_ENTRY_VERSION;
+ } while (FALSE);
+
// 2. BiosModule
//
do {
@@ -1630,6 +1681,7 @@ Returns:
// Final: Check StartupAcm in BiosModule.
//
CheckOverlap (gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size);
+ CheckOverlap (gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size);
FitEntryNumber = gFitTableContext.FitEntryNumber;
for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; Index++) {
if ((gFitTableContext.OptionalModule[Index].Type == FIT_TABLE_TYPE_BIOS_POLICY) ||
@@ -1896,6 +1948,9 @@ Returns:
if (gFitTableContext.StartupAcm.Address != 0) {
printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size, gFitTableContext.StartupAcmVersion);
}
+ if (gFitTableContext.DiagnstAcm.Address != 0) {
+ printf ("DiagnosticAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size, gFitTableContext.DiagnstAcmVersion);
+ }
for (Index = 0; Index < gFitTableContext.BiosModuleNumber; Index++) {
printf ("BiosModule[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTableContext.BiosModule[Index].Address, gFitTableContext.BiosModule[Index].Size, gFitTableContext.BiosModuleVersion);
}
@@ -1920,6 +1975,7 @@ CHAR8 *mFitTypeStr[] = {
" ",
"MICROCODE ",
"STARTUP_ACM",
+ "DIAGNST_ACM",
" ",
" ",
" ",
@@ -2488,6 +2544,18 @@ Returns:
FitIndex++;
}
+ //
+ // 4.5. DiagnosticAcm
+ //
+ if (gFitTableContext.DiagnstAcm.Address != 0) {
+ FitEntry[FitIndex].Address = gFitTableContext.DiagnstAcm.Address;
+ *(UINT32 *)&FitEntry[FitIndex].Size[0] = 0;
+ FitEntry[FitIndex].Version = (UINT16)gFitTableContext.DiagnstAcmVersion;
+ FitEntry[FitIndex].Type = FIT_TABLE_TYPE_DIAGNST_ACM;
+ FitEntry[FitIndex].C_V = 0;
+ FitEntry[FitIndex].Checksum = 0;
+ FitIndex++;
+ }
//
// 5. BiosModule
//
--
2.14.3.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#53798): https://edk2.groups.io/g/devel/message/53798
Mute This Topic: https://groups.io/mt/70987805/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Agrawal: I have two comments. 1. CheckOverlap (gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size); I see Size is always zero. If so, is this checker still required? 2. Update edk2-platforms\Silicon\Intel\Tools\FitGen\FitGen.h UTILITY_MINOR_VERSION to new value. Thanks Liming > -----Original Message----- > From: Agrawal, Sachin <sachin.agrawal@intel.com> > Sent: Wednesday, February 5, 2020 9:27 AM > To: devel@edk2.groups.io > Cc: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com> > Subject: [PATCH v1] Add support for Diagnostics ACM in FitGen tool > > From: "Agrawal, Sachin" <sachin.agrawal@intel.com> > > REF https://bugzilla.tianocore.org/show_bug.cgi?id=2200 > > FitGen Tool is responsible for creating FIT table in UEFI BIOS. > A new FIT entry type (FIT Type 0x3) has been allocated for Diagnsotics ACM. > FitGen tool is updated to add support for this Diagnostics ACM. > > Cc: Bob Feng <bob.c.feng@intel.com> > Cc: Liming Gao <liming.gao@intel.com> > > Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com> > --- > Silicon/Intel/Tools/FitGen/FitGen.c | 68 ++++++++++++++++++++ > 1 file changed, 68 insertions(+) > > diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c > index 833610f2a0..48fbe1ef85 100644 > --- a/Silicon/Intel/Tools/FitGen/FitGen.c > +++ b/Silicon/Intel/Tools/FitGen/FitGen.c > @@ -217,6 +217,7 @@ typedef struct { > #define FIT_TABLE_TYPE_HEADER 0 > #define FIT_TABLE_TYPE_MICROCODE 1 > #define FIT_TABLE_TYPE_STARTUP_ACM 2 > +#define FIT_TABLE_TYPE_DIAGNST_ACM 3 > #define FIT_TABLE_TYPE_BIOS_MODULE 7 > #define FIT_TABLE_TYPE_TPM_POLICY 8 > #define FIT_TABLE_TYPE_BIOS_POLICY 9 > @@ -246,6 +247,8 @@ typedef struct { > UINT32 FitHeaderVersion; > FIT_TABLE_CONTEXT_ENTRY StartupAcm; > UINT32 StartupAcmVersion; > + FIT_TABLE_CONTEXT_ENTRY DiagnstAcm; > + UINT32 DiagnstAcmVersion; > FIT_TABLE_CONTEXT_ENTRY BiosModule[MAX_BIOS_MODULE_ENTRY]; > UINT32 BiosModuleVersion; > FIT_TABLE_CONTEXT_ENTRY Microcode[MAX_MICROCODE_ENTRY]; > @@ -318,6 +321,7 @@ Returns: > "\t[-L <MicrocodeSlotSize> <MicrocodeFfsGuid>]\n" > "\t[-I <BiosInfoGuid>]\n" > "\t[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>] [-V <StartupAcmVersion>]\n" > + "\t[-U <DiagnstAcmAddress>|<DiagnstAcmGuid>]\n" > "\t[-B <BiosModuleAddress BiosModuleSize>] [-B ...] [-V <BiosModuleVersion>]\n" > "\t[-M <MicrocodeAddress MicrocodeSize>] [-M ...]|[-U <MicrocodeFv MicrocodeBase>|<MicrocodeRegionOffset > MicrocodeRegionSize>|<MicrocodeGuid>] [-V <MicrocodeVersion>]\n" > "\t[-O RecordType <RecordDataAddress RecordDataSize>|<RESERVE RecordDataSize>|<RecordDataGuid>|<RecordBinFile> [-V > <RecordVersion>]] [-O ... [-V ...]]\n" > @@ -332,6 +336,8 @@ Returns: > printf ("\tStartupAcmAddress - Address of StartupAcm.\n"); > printf ("\tStartupAcmSize - Size of StartupAcm.\n"); > printf ("\tStartupAcmGuid - Guid of StartupAcm Module, if StartupAcm is in a BiosModule, it will be excluded form that.\n"); > + printf ("\tDiagnstAcmAddress - Address of DiagnstAcm.\n"); > + printf ("\tDiagnstAcmGuid - Guid of DiagnstAcm Module, if DiagnstAcm is in a BiosModule, it will be excluded from that.\n"); > printf ("\tBiosModuleAddress - Address of BiosModule. User should ensure there is no overlap.\n"); > printf ("\tBiosModuleSize - Size of BiosModule.\n"); > printf ("\tMicrocodeAddress - Address of Microcode.\n"); > @@ -990,6 +996,17 @@ Returns: > gFitTableContext.StartupAcmVersion = BiosInfoStruct[BiosInfoIndex].Version; > gFitTableContext.FitEntryNumber ++; > break; > + case FIT_TABLE_TYPE_DIAGNST_ACM: > + if (gFitTableContext.DiagnstAcm.Type != 0) { > + Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated DiagnosticsAcm!", NULL); > + return 0; > + } > + gFitTableContext.DiagnstAcm.Type = FIT_TABLE_TYPE_DIAGNST_ACM; > + gFitTableContext.DiagnstAcm.Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address; > + gFitTableContext.DiagnstAcm.Size = 0; > + gFitTableContext.DiagnstAcmVersion = DEFAULT_FIT_ENTRY_VERSION; > + gFitTableContext.FitEntryNumber ++; > + break; > case FIT_TABLE_TYPE_BIOS_MODULE: > if ((BiosInfoStruct[BiosInfoIndex].Attributes & BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB) != 0) { > continue; > @@ -1223,6 +1240,40 @@ Returns: > } while (FALSE); > > // > + // 1.5. DiagnosticsAcm > + // > + do { > + if ((Index + 1 >= argc) || > + ((strcmp (argv[Index], "-U") != 0) && > + (strcmp (argv[Index], "-u") != 0)) ) { > + if (BiosInfoExist && (gFitTableContext.DiagnstAcm.Type == FIT_TABLE_TYPE_DIAGNST_ACM)) { > + break; > + } > + break; > + } > + if (IsGuidData (argv[Index + 1], &Guid)) { > + FileBuffer = FindFileFromFvByGuid (FdBuffer, FdSize, &Guid, &FileSize); > + if (FileBuffer == NULL) { > + Error (NULL, 0, 0, "-U Parameter incorrect, GUID not found!", "%s", argv[Index + 1]); > + return 0; > + } > + FileBuffer = (UINT8 *)MEMORY_TO_FLASH (FileBuffer, FdBuffer, FdSize); > + Index += 2; > + } else { > + FileBuffer = (UINT8 *) (UINTN) xtoi (argv[Index + 1]); > + Index += 2; > + } > + if (gFitTableContext.DiagnstAcm.Type != 0) { > + Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated DiagnosticsAcm!", NULL); > + return 0; > + } > + gFitTableContext.DiagnstAcm.Type = FIT_TABLE_TYPE_DIAGNST_ACM; > + gFitTableContext.DiagnstAcm.Address = (UINT32) (UINTN) FileBuffer; > + gFitTableContext.DiagnstAcm.Size = 0; > + gFitTableContext.FitEntryNumber ++; > + gFitTableContext.DiagnstAcmVersion = DEFAULT_FIT_ENTRY_VERSION; > + } while (FALSE); > + > // 2. BiosModule > // > do { > @@ -1630,6 +1681,7 @@ Returns: > // Final: Check StartupAcm in BiosModule. > // > CheckOverlap (gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size); > + CheckOverlap (gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size); > FitEntryNumber = gFitTableContext.FitEntryNumber; > for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; Index++) { > if ((gFitTableContext.OptionalModule[Index].Type == FIT_TABLE_TYPE_BIOS_POLICY) || > @@ -1896,6 +1948,9 @@ Returns: > if (gFitTableContext.StartupAcm.Address != 0) { > printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size, > gFitTableContext.StartupAcmVersion); > } > + if (gFitTableContext.DiagnstAcm.Address != 0) { > + printf ("DiagnosticAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size, > gFitTableContext.DiagnstAcmVersion); > + } > for (Index = 0; Index < gFitTableContext.BiosModuleNumber; Index++) { > printf ("BiosModule[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTableContext.BiosModule[Index].Address, > gFitTableContext.BiosModule[Index].Size, gFitTableContext.BiosModuleVersion); > } > @@ -1920,6 +1975,7 @@ CHAR8 *mFitTypeStr[] = { > " ", > "MICROCODE ", > "STARTUP_ACM", > + "DIAGNST_ACM", > " ", > " ", > " ", > @@ -2488,6 +2544,18 @@ Returns: > FitIndex++; > } > > + // > + // 4.5. DiagnosticAcm > + // > + if (gFitTableContext.DiagnstAcm.Address != 0) { > + FitEntry[FitIndex].Address = gFitTableContext.DiagnstAcm.Address; > + *(UINT32 *)&FitEntry[FitIndex].Size[0] = 0; > + FitEntry[FitIndex].Version = (UINT16)gFitTableContext.DiagnstAcmVersion; > + FitEntry[FitIndex].Type = FIT_TABLE_TYPE_DIAGNST_ACM; > + FitEntry[FitIndex].C_V = 0; > + FitEntry[FitIndex].Checksum = 0; > + FitIndex++; > + } > // > // 5. BiosModule > // > -- > 2.14.3.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#53997): https://edk2.groups.io/g/devel/message/53997 Mute This Topic: https://groups.io/mt/70987805/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
© 2016 - 2024 Red Hat, Inc.