Date
1 - 4 of 4
[PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool
Lin, Jason1
From: Jason1 Lin <jason1.lin@...>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3958 Within current FitGen tool there had limitation only allow one S-ACM to generate the Type 2 entry. This code change is used to support multiple type 2 entries up to 0x20. Signed-off-by: Jason1 Lin <jason1.lin@...> Cc: Bob Feng <bob.c.feng@...> Cc: Liming Gao <gaoliming@...> Cc: Yuwei Chen <yuwei.chen@...> Cc: Isaac W Oram <isaac.w.oram@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Cc: Dakota Chiang <dakota.chiang@...> --- Silicon/Intel/Tools/FitGen/FitGen.c | 89 +++++++++++--------- Silicon/Intel/Tools/FitGen/FitGen.h | 4 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 4de72ea422..eac8fa8715 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -2,7 +2,7 @@ This utility is part of build process for IA32/X64 FD.=0D It generates FIT table.=0D =0D -Copyright (c) 2010-2021, Intel Corporation. All rights reserved.<BR>=0D +Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -204,6 +204,7 @@ typedef struct { =0D #define MAX_BIOS_MODULE_ENTRY 0x20=0D #define MAX_MICROCODE_ENTRY 0x20=0D +#define MAX_STARTUP_ACM_ENTRY 0x20=0D #define MAX_OPTIONAL_ENTRY 0x20=0D #define MAX_PORT_ENTRY 0x20=0D =0D @@ -255,11 +256,12 @@ typedef struct { UINT32 FitEntryNumber;=0D UINT32 BiosModuleNumber;=0D UINT32 MicrocodeNumber;=0D + UINT32 StartupAcmNumber;=0D UINT32 OptionalModuleNumber;=0D UINT32 PortModuleNumber;=0D UINT32 GlobalVersion;=0D UINT32 FitHeaderVersion;=0D - FIT_TABLE_CONTEXT_ENTRY StartupAcm;=0D + FIT_TABLE_CONTEXT_ENTRY StartupAcm[MAX_STARTUP_ACM_ENTRY];=0D UINT32 StartupAcmVersion;=0D FIT_TABLE_CONTEXT_ENTRY DiagnstAcm;=0D UINT32 DiagnstAcmVersion;=0D @@ -1149,14 +1151,15 @@ Returns: Error (NULL, 0, 0, "-I Parameter incorrect, Header Type unsuppor= ted!", NULL);=0D return 0;=0D case FIT_TABLE_TYPE_STARTUP_ACM:=0D - if (gFitTableContext.StartupAcm.Type !=3D 0) {=0D - Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated Startup= Acm!", NULL);=0D + if (gFitTableContext.StartupAcmNumber >=3D MAX_STARTUP_ACM_ENTRY= ) {=0D + Error (NULL, 0, 0, "-I Parameter incorrect, too many StartupAc= m!", NULL);=0D return 0;=0D }=0D - gFitTableContext.StartupAcm.Type =3D FIT_TABLE_TYPE_STARTUP_A= CM;=0D - gFitTableContext.StartupAcm.Address =3D (UINT32)BiosInfoStruct[B= iosInfoIndex].Address;=0D - gFitTableContext.StartupAcm.Size =3D (UINT32)BiosInfoStruct[B= iosInfoIndex].Size;=0D - gFitTableContext.StartupAcmVersion =3D BiosInfoStruct[BiosInfoI= ndex].Version;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].T= ype =3D FIT_TABLE_TYPE_STARTUP_ACM;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].A= ddress =3D (UINT32)BiosInfoStruct[BiosInfoIndex].Address;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].S= ize =3D (UINT32)BiosInfoStruct[BiosInfoIndex].Size;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].V= ersion =3D BiosInfoStruct[BiosInfoIndex].Version;=0D + gFitTableContext.StartupAcmNumber ++;=0D gFitTableContext.FitEntryNumber ++;=0D break;=0D case FIT_TABLE_TYPE_DIAGNST_ACM:=0D @@ -1351,16 +1354,15 @@ Returns: //=0D // 1. StartupAcm=0D //=0D - do {=0D + while (TRUE) {=0D if ((Index + 1 >=3D argc) ||=0D ((strcmp (argv[Index], "-S") !=3D 0) &&=0D (strcmp (argv[Index], "-s") !=3D 0)) ) {=0D - if (BiosInfoExist && (gFitTableContext.StartupAcm.Type =3D=3D FIT_TA= BLE_TYPE_STARTUP_ACM)) {=0D - break;=0D + if (gFitTableContext.StartupAcmNumber =3D=3D 0) {=0D + printf ("-S not found. WARNING!\n");=0D }=0D // Error (NULL, 0, 0, "-S Parameter incorrect, expect -S!", NULL);=0D // return 0;=0D - printf ("-S not found. WARNING!\n");=0D break;=0D }=0D if (IsGuidData (argv[Index + 1], &Guid)) {=0D @@ -1381,14 +1383,13 @@ Returns: FileSize =3D xtoi (argv[Index + 2]);=0D Index +=3D 3;=0D }=0D - if (gFitTableContext.StartupAcm.Type !=3D 0) {=0D - Error (NULL, 0, 0, "-S Parameter incorrect, Duplicated StartupAcm!",= NULL);=0D + if (gFitTableContext.StartupAcmNumber >=3D MAX_STARTUP_ACM_ENTRY) {=0D + Error (NULL, 0, 0, "-S Parameter incorrect, too many StartupAcm!", N= ULL);=0D return 0;=0D }=0D - gFitTableContext.StartupAcm.Type =3D FIT_TABLE_TYPE_STARTUP_ACM;=0D - gFitTableContext.StartupAcm.Address =3D (UINT32) (UINTN) FileBuffer;=0D - gFitTableContext.StartupAcm.Size =3D FileSize;=0D - gFitTableContext.FitEntryNumber ++;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = =3D FIT_TABLE_TYPE_STARTUP_ACM;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address= =3D (UINT32) (UINTN) FileBuffer;=0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = =3D FileSize;=0D =0D //=0D // 1.1 StartupAcm version=0D @@ -1407,7 +1408,10 @@ Returns: gFitTableContext.StartupAcmVersion =3D xtoi (argv[Index + 1]);=0D Index +=3D 2;=0D }=0D - } while (FALSE);=0D +=0D + gFitTableContext.StartupAcmNumber ++;=0D + gFitTableContext.FitEntryNumber ++;=0D + }=0D =0D //=0D // 1.5. DiagnosticsAcm=0D @@ -1890,7 +1894,9 @@ Returns: //=0D // Final: Check StartupAcm in BiosModule.=0D //=0D - CheckOverlap (gFitTableContext.StartupAcm.Address, gFitTableContext.Star= tupAcm.Size);=0D + for (Index =3D 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index= ++) {=0D + CheckOverlap (gFitTableContext.StartupAcm[Index].Address, gFitTableCon= text.StartupAcm[Index].Size);=0D + }=0D FitEntryNumber =3D gFitTableContext.FitEntryNumber;=0D for (Index =3D 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; I= ndex++) {=0D if ((gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BIOS_POLICY) ||=0D @@ -2178,8 +2184,8 @@ Returns: }=0D printf ("Total FIT Entry number: 0x%x\n", gFitTableContext.FitEntryNumbe= r);=0D printf ("FitHeader version: 0x%04x\n", gFitTableContext.FitHeaderVersion= );=0D - if (gFitTableContext.StartupAcm.Address !=3D 0) {=0D - printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.St= artupAcm.Address, gFitTableContext.StartupAcm.Size, gFitTableContext.Startu= pAcmVersion);=0D + for (Index =3D 0; Index < gFitTableContext.StartupAcmNumber; Index++) {= =0D + printf ("StartupAcm[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTabl= eContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].Size= , gFitTableContext.StartupAcmVersion);=0D }=0D if (gFitTableContext.DiagnstAcm.Address !=3D 0) {=0D printf ("DiagnosticAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext= .DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size, gFitTableContext.Dia= gnstAcmVersion);=0D @@ -2809,8 +2815,8 @@ Returns: //=0D // 4. StartupAcm=0D //=0D - if (gFitTableContext.StartupAcm.Address !=3D 0) {=0D - FitEntry[FitIndex].Address =3D gFitTableContext.StartupAcm= .Address;=0D + for (Index =3D 0; Index < gFitTableContext.StartupAcmNumber; Index++) {= =0D + FitEntry[FitIndex].Address =3D gFitTableContext.StartupAcm= [Index].Address;=0D *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0; //gFitTableContext.Start= upAcm.Size / 16;=0D FitEntry[FitIndex].Version =3D (UINT16)gFitTableContext.St= artupAcmVersion;=0D FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_STARTUP_ACM;= =0D @@ -3110,7 +3116,7 @@ GetFitEntryInfo ( =0D Routine Description:=0D =0D - Fill the FIT table information to Fvrecovery=0D + Get the FIT table information from Fvrecovery=0D =0D Arguments:=0D =0D @@ -3164,8 +3170,8 @@ Returns: gFitTableContext.MicrocodeNumber ++;=0D break;=0D case FIT_TABLE_TYPE_STARTUP_ACM:=0D - gFitTableContext.StartupAcm.Address =3D (UINT32)FitEntry[FitIndex].A= ddress;=0D - gFitTableContext.StartupAcmVersion =3D FitEntry[FitIndex].Version;= =0D + gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Addre= ss =3D (UINT32)FitEntry[FitIndex].Address;=0D + gFitTableContext.StartupAcmVersion = =3D FitEntry[FitIndex].Version;=0D break;=0D case FIT_TABLE_TYPE_BIOS_MODULE:=0D gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Addre= ss =3D (UINT32)FitEntry[FitIndex].Address;=0D @@ -3232,6 +3238,7 @@ Returns: UINT32 FdFileSize;=0D =0D UINT8 *AcmBuffer;=0D + INTN Index;=0D UINT32 FixedFitLocation;=0D =0D FileBufferRaw =3D NULL;=0D @@ -3323,22 +3330,23 @@ Returns: //=0D // Get ACM buffer=0D //=0D - if (gFitTableContext.StartupAcm.Address !=3D 0) {=0D - AcmBuffer =3D FLASH_TO_MEMORY(gFitTableContext.StartupAcm.Address, F= dFileBuffer, FdFileSize);=0D - if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.Star= tupAcm.Size > FdFileBuffer + FdFileSize)) {=0D - printf ("ACM out of range - can not validate it\n");=0D - AcmBuffer =3D NULL;=0D - }=0D + for (Index =3D 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Ind= ex ++) {=0D + if (gFitTableContext.StartupAcm[Index].Address !=3D 0) {=0D + AcmBuffer =3D FLASH_TO_MEMORY(gFitTableContext.StartupAcm[Index].A= ddress, FdFileBuffer, FdFileSize);=0D + if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.St= artupAcm[Index].Size > FdFileBuffer + FdFileSize)) {=0D + printf ("ACM out of range - can not validate it\n");=0D + AcmBuffer =3D NULL;=0D + }=0D =0D - if (AcmBuffer !=3D NULL) {=0D - if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm= .Size)) {=0D - DumpAcm ((ACM_FORMAT *)AcmBuffer);=0D - } else {=0D - Status =3D STATUS_ERROR;=0D - goto exitFunc;=0D + if (AcmBuffer !=3D NULL) {=0D + if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupA= cm[Index].Size)) {=0D + DumpAcm ((ACM_FORMAT *)AcmBuffer);=0D + } else {=0D + Status =3D STATUS_ERROR;=0D + goto exitFunc;=0D + }=0D }=0D }=0D -=0D }=0D =0D //=0D @@ -3576,4 +3584,3 @@ Returns: =0D return u;=0D }=0D -=0D diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 5add6a8870..b7de0a6b2d 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -1,7 +1,7 @@ /**@file=0D Definitions for the FitGen utility.=0D =0D -Copyright (c) 2010-2020, Intel Corporation. All rights reserved.<BR>=0D +Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR>=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D **/=0D @@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information=0D //=0D #define UTILITY_MAJOR_VERSION 0=0D -#define UTILITY_MINOR_VERSION 64=0D +#define UTILITY_MINOR_VERSION 65=0D #define UTILITY_DATE __DATE__=0D =0D //=0D --=20 2.37.0.windows.1
|
|
Oram, Isaac W
Reviewed-by: Isaac W Oram <isaac.w.oram@...>
toggle quoted messageShow quoted text
-----Original Message-----
From: Lin, Jason1 <jason1.lin@...> Sent: Friday, July 1, 2022 8:10 AM To: devel@edk2.groups.io Cc: Lin, Jason1 <jason1.lin@...>; Feng, Bob C <bob.c.feng@...>; Gao, Liming <gaoliming@...>; Chen, Christine <yuwei.chen@...>; Oram, Isaac W <isaac.w.oram@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...>; Chiang, Dakota <dakota.chiang@...> Subject: [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool From: Jason1 Lin <jason1.lin@...> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3958 Within current FitGen tool there had limitation only allow one S-ACM to generate the Type 2 entry. This code change is used to support multiple type 2 entries up to 0x20. Signed-off-by: Jason1 Lin <jason1.lin@...> Cc: Bob Feng <bob.c.feng@...> Cc: Liming Gao <gaoliming@...> Cc: Yuwei Chen <yuwei.chen@...> Cc: Isaac W Oram <isaac.w.oram@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Cc: Dakota Chiang <dakota.chiang@...> --- Silicon/Intel/Tools/FitGen/FitGen.c | 89 +++++++++++--------- Silicon/Intel/Tools/FitGen/FitGen.h | 4 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c index 4de72ea422..eac8fa8715 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -2,7 +2,7 @@ This utility is part of build process for IA32/X64 FD. It generates FIT table. -Copyright (c) 2010-2021, Intel Corporation. All rights reserved.<BR>+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/@@ -204,6 +204,7 @@ typedef struct { #define MAX_BIOS_MODULE_ENTRY 0x20 #define MAX_MICROCODE_ENTRY 0x20+#define MAX_STARTUP_ACM_ENTRY 0x20 #define MAX_OPTIONAL_ENTRY 0x20 #define MAX_PORT_ENTRY 0x20 @@ -255,11 +256,12 @@ typedef struct { UINT32 FitEntryNumber; UINT32 BiosModuleNumber; UINT32 MicrocodeNumber;+ UINT32 StartupAcmNumber; UINT32 OptionalModuleNumber; UINT32 PortModuleNumber; UINT32 GlobalVersion; UINT32 FitHeaderVersion;- FIT_TABLE_CONTEXT_ENTRY StartupAcm;+ FIT_TABLE_CONTEXT_ENTRY StartupAcm[MAX_STARTUP_ACM_ENTRY]; UINT32 StartupAcmVersion; FIT_TABLE_CONTEXT_ENTRY DiagnstAcm; UINT32 DiagnstAcmVersion;@@ -1149,14 +1151,15 @@ Returns: Error (NULL, 0, 0, "-I Parameter incorrect, Header Type unsupported!", NULL); return 0; case FIT_TABLE_TYPE_STARTUP_ACM:- if (gFitTableContext.StartupAcm.Type != 0) {- Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated StartupAcm!", NULL);+ if (gFitTableContext.StartupAcmNumber >= MAX_STARTUP_ACM_ENTRY) {+ Error (NULL, 0, 0, "-I Parameter incorrect, too many StartupAcm!", NULL); return 0; }- gFitTableContext.StartupAcm.Type = FIT_TABLE_TYPE_STARTUP_ACM;- gFitTableContext.StartupAcm.Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;- gFitTableContext.StartupAcm.Size = (UINT32)BiosInfoStruct[BiosInfoIndex].Size;- gFitTableContext.StartupAcmVersion = BiosInfoStruct[BiosInfoIndex].Version;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FIT_TABLE_TYPE_STARTUP_ACM;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = (UINT32)BiosInfoStruct[BiosInfoIndex].Size;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Version = BiosInfoStruct[BiosInfoIndex].Version;+ gFitTableContext.StartupAcmNumber ++; gFitTableContext.FitEntryNumber ++; break; case FIT_TABLE_TYPE_DIAGNST_ACM:@@ -1351,16 +1354,15 @@ Returns: // // 1. StartupAcm //- do {+ while (TRUE) { if ((Index + 1 >= argc) || ((strcmp (argv[Index], "-S") != 0) && (strcmp (argv[Index], "-s") != 0)) ) {- if (BiosInfoExist && (gFitTableContext.StartupAcm.Type == FIT_TABLE_TYPE_STARTUP_ACM)) {- break;+ if (gFitTableContext.StartupAcmNumber == 0) {+ printf ("-S not found. WARNING!\n"); } // Error (NULL, 0, 0, "-S Parameter incorrect, expect -S!", NULL); // return 0;- printf ("-S not found. WARNING!\n"); break; } if (IsGuidData (argv[Index + 1], &Guid)) {@@ -1381,14 +1383,13 @@ Returns: FileSize = xtoi (argv[Index + 2]); Index += 3; }- if (gFitTableContext.StartupAcm.Type != 0) {- Error (NULL, 0, 0, "-S Parameter incorrect, Duplicated StartupAcm!", NULL);+ if (gFitTableContext.StartupAcmNumber >= MAX_STARTUP_ACM_ENTRY) {+ Error (NULL, 0, 0, "-S Parameter incorrect, too many StartupAcm!", NULL); return 0; }- gFitTableContext.StartupAcm.Type = FIT_TABLE_TYPE_STARTUP_ACM;- gFitTableContext.StartupAcm.Address = (UINT32) (UINTN) FileBuffer;- gFitTableContext.StartupAcm.Size = FileSize;- gFitTableContext.FitEntryNumber ++;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FIT_TABLE_TYPE_STARTUP_ACM;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32) (UINTN) FileBuffer;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = FileSize; // // 1.1 StartupAcm version@@ -1407,7 +1408,10 @@ Returns: gFitTableContext.StartupAcmVersion = xtoi (argv[Index + 1]); Index += 2; }- } while (FALSE);++ gFitTableContext.StartupAcmNumber ++;+ gFitTableContext.FitEntryNumber ++;+ } // // 1.5. DiagnosticsAcm@@ -1890,7 +1894,9 @@ Returns: // // Final: Check StartupAcm in BiosModule. //- CheckOverlap (gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size);+ for (Index = 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index++) {+ CheckOverlap (gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].Size);+ } FitEntryNumber = gFitTableContext.FitEntryNumber; for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; Index++) { if ((gFitTableContext.OptionalModule[Index].Type == FIT_TABLE_TYPE_BIOS_POLICY) ||@@ -2178,8 +2184,8 @@ Returns: } printf ("Total FIT Entry number: 0x%x\n", gFitTableContext.FitEntryNumber); printf ("FitHeader version: 0x%04x\n", gFitTableContext.FitHeaderVersion);- if (gFitTableContext.StartupAcm.Address != 0) {- printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size, gFitTableContext.StartupAcmVersion);+ for (Index = 0; Index < gFitTableContext.StartupAcmNumber; Index++) {+ printf ("StartupAcm[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].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);@@ -2809,8 +2815,8 @@ Returns: // // 4. StartupAcm //- if (gFitTableContext.StartupAcm.Address != 0) {- FitEntry[FitIndex].Address = gFitTableContext.StartupAcm.Address;+ for (Index = 0; Index < gFitTableContext.StartupAcmNumber; Index++) {+ FitEntry[FitIndex].Address = gFitTableContext.StartupAcm[Index].Address; *(UINT32 *)&FitEntry[FitIndex].Size[0] = 0; //gFitTableContext.StartupAcm.Size / 16; FitEntry[FitIndex].Version = (UINT16)gFitTableContext.StartupAcmVersion; FitEntry[FitIndex].Type = FIT_TABLE_TYPE_STARTUP_ACM;@@ -3110,7 +3116,7 @@ GetFitEntryInfo ( Routine Description: - Fill the FIT table information to Fvrecovery+ Get the FIT table information from Fvrecovery Arguments: @@ -3164,8 +3170,8 @@ Returns: gFitTableContext.MicrocodeNumber ++; break; case FIT_TABLE_TYPE_STARTUP_ACM:- gFitTableContext.StartupAcm.Address = (UINT32)FitEntry[FitIndex].Address;- gFitTableContext.StartupAcmVersion = FitEntry[FitIndex].Version;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)FitEntry[FitIndex].Address;+ gFitTableContext.StartupAcmVersion = FitEntry[FitIndex].Version; break; case FIT_TABLE_TYPE_BIOS_MODULE: gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Address = (UINT32)FitEntry[FitIndex].Address;@@ -3232,6 +3238,7 @@ Returns: UINT32 FdFileSize; UINT8 *AcmBuffer;+ INTN Index; UINT32 FixedFitLocation; FileBufferRaw = NULL;@@ -3323,22 +3330,23 @@ Returns: // // Get ACM buffer //- if (gFitTableContext.StartupAcm.Address != 0) {- AcmBuffer = FLASH_TO_MEMORY(gFitTableContext.StartupAcm.Address, FdFileBuffer, FdFileSize);- if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.StartupAcm.Size > FdFileBuffer + FdFileSize)) {- printf ("ACM out of range - can not validate it\n");- AcmBuffer = NULL;- }+ for (Index = 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index ++) {+ if (gFitTableContext.StartupAcm[Index].Address != 0) {+ AcmBuffer = FLASH_TO_MEMORY(gFitTableContext.StartupAcm[Index].Address, FdFileBuffer, FdFileSize);+ if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.StartupAcm[Index].Size > FdFileBuffer + FdFileSize)) {+ printf ("ACM out of range - can not validate it\n");+ AcmBuffer = NULL;+ } - if (AcmBuffer != NULL) {- if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm.Size)) {- DumpAcm ((ACM_FORMAT *)AcmBuffer);- } else {- Status = STATUS_ERROR;- goto exitFunc;+ if (AcmBuffer != NULL) {+ if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm[Index].Size)) {+ DumpAcm ((ACM_FORMAT *)AcmBuffer);+ } else {+ Status = STATUS_ERROR;+ goto exitFunc;+ } } }- } //@@ -3576,4 +3584,3 @@ Returns: return u; }-diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitGen/FitGen.h index 5add6a8870..b7de0a6b2d 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -1,7 +1,7 @@ /**@file Definitions for the FitGen utility. -Copyright (c) 2010-2020, Intel Corporation. All rights reserved.<BR>+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information // #define UTILITY_MAJOR_VERSION 0-#define UTILITY_MINOR_VERSION 64+#define UTILITY_MINOR_VERSION 65 #define UTILITY_DATE __DATE__ //-- 2.37.0.windows.1
|
|
Yuwei Chen
Reviewed-by: Yuwei Chen<yuwei.chen@...>
toggle quoted messageShow quoted text
-----Original Message-----
|
|
Bob Feng
This patch series was pushed.
toggle quoted messageShow quoted text
Thanks, Bob
-----Original Message-----
From: Lin, Jason1 <jason1.lin@...> Sent: Friday, July 1, 2022 11:10 PM To: devel@edk2.groups.io Cc: Lin, Jason1 <jason1.lin@...>; Feng, Bob C <bob.c.feng@...>; Gao, Liming <gaoliming@...>; Chen, Christine <yuwei.chen@...>; Oram, Isaac W <isaac.w.oram@...>; Chaganty, Rangasai V <rangasai.v.chaganty@...>; Chiang, Dakota <dakota.chiang@...> Subject: [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool From: Jason1 Lin <jason1.lin@...> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3958 Within current FitGen tool there had limitation only allow one S-ACM to generate the Type 2 entry. This code change is used to support multiple type 2 entries up to 0x20. Signed-off-by: Jason1 Lin <jason1.lin@...> Cc: Bob Feng <bob.c.feng@...> Cc: Liming Gao <gaoliming@...> Cc: Yuwei Chen <yuwei.chen@...> Cc: Isaac W Oram <isaac.w.oram@...> Cc: Rangasai V Chaganty <rangasai.v.chaganty@...> Cc: Dakota Chiang <dakota.chiang@...> --- Silicon/Intel/Tools/FitGen/FitGen.c | 89 +++++++++++--------- Silicon/Intel/Tools/FitGen/FitGen.h | 4 +- 2 files changed, 50 insertions(+), 43 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c index 4de72ea422..eac8fa8715 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -2,7 +2,7 @@ This utility is part of build process for IA32/X64 FD. It generates FIT table. -Copyright (c) 2010-2021, Intel Corporation. All rights reserved.<BR>+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/@@ -204,6 +204,7 @@ typedef struct { #define MAX_BIOS_MODULE_ENTRY 0x20 #define MAX_MICROCODE_ENTRY 0x20+#define MAX_STARTUP_ACM_ENTRY 0x20 #define MAX_OPTIONAL_ENTRY 0x20 #define MAX_PORT_ENTRY 0x20 @@ -255,11 +256,12 @@ typedef struct { UINT32 FitEntryNumber; UINT32 BiosModuleNumber; UINT32 MicrocodeNumber;+ UINT32 StartupAcmNumber; UINT32 OptionalModuleNumber; UINT32 PortModuleNumber; UINT32 GlobalVersion; UINT32 FitHeaderVersion;- FIT_TABLE_CONTEXT_ENTRY StartupAcm;+ FIT_TABLE_CONTEXT_ENTRY StartupAcm[MAX_STARTUP_ACM_ENTRY]; UINT32 StartupAcmVersion; FIT_TABLE_CONTEXT_ENTRY DiagnstAcm; UINT32 DiagnstAcmVersion;@@ -1149,14 +1151,15 @@ Returns: Error (NULL, 0, 0, "-I Parameter incorrect, Header Type unsupported!", NULL); return 0; case FIT_TABLE_TYPE_STARTUP_ACM:- if (gFitTableContext.StartupAcm.Type != 0) {- Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated StartupAcm!", NULL);+ if (gFitTableContext.StartupAcmNumber >= MAX_STARTUP_ACM_ENTRY) {+ Error (NULL, 0, 0, "-I Parameter incorrect, too many StartupAcm!", NULL); return 0; }- gFitTableContext.StartupAcm.Type = FIT_TABLE_TYPE_STARTUP_ACM;- gFitTableContext.StartupAcm.Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;- gFitTableContext.StartupAcm.Size = (UINT32)BiosInfoStruct[BiosInfoIndex].Size;- gFitTableContext.StartupAcmVersion = BiosInfoStruct[BiosInfoIndex].Version;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FIT_TABLE_TYPE_STARTUP_ACM;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)BiosInfoStruct[BiosInfoIndex].Address;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = (UINT32)BiosInfoStruct[BiosInfoIndex].Size;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Version = BiosInfoStruct[BiosInfoIndex].Version;+ gFitTableContext.StartupAcmNumber ++; gFitTableContext.FitEntryNumber ++; break; case FIT_TABLE_TYPE_DIAGNST_ACM:@@ -1351,16 +1354,15 @@ Returns: // // 1. StartupAcm //- do {+ while (TRUE) { if ((Index + 1 >= argc) || ((strcmp (argv[Index], "-S") != 0) && (strcmp (argv[Index], "-s") != 0)) ) {- if (BiosInfoExist && (gFitTableContext.StartupAcm.Type == FIT_TABLE_TYPE_STARTUP_ACM)) {- break;+ if (gFitTableContext.StartupAcmNumber == 0) {+ printf ("-S not found. WARNING!\n"); } // Error (NULL, 0, 0, "-S Parameter incorrect, expect -S!", NULL); // return 0;- printf ("-S not found. WARNING!\n"); break; } if (IsGuidData (argv[Index + 1], &Guid)) {@@ -1381,14 +1383,13 @@ Returns: FileSize = xtoi (argv[Index + 2]); Index += 3; }- if (gFitTableContext.StartupAcm.Type != 0) {- Error (NULL, 0, 0, "-S Parameter incorrect, Duplicated StartupAcm!", NULL);+ if (gFitTableContext.StartupAcmNumber >= MAX_STARTUP_ACM_ENTRY) {+ Error (NULL, 0, 0, "-S Parameter incorrect, too many StartupAcm!", NULL); return 0; }- gFitTableContext.StartupAcm.Type = FIT_TABLE_TYPE_STARTUP_ACM;- gFitTableContext.StartupAcm.Address = (UINT32) (UINTN) FileBuffer;- gFitTableContext.StartupAcm.Size = FileSize;- gFitTableContext.FitEntryNumber ++;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FIT_TABLE_TYPE_STARTUP_ACM;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32) (UINTN) FileBuffer;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = FileSize; // // 1.1 StartupAcm version@@ -1407,7 +1408,10 @@ Returns: gFitTableContext.StartupAcmVersion = xtoi (argv[Index + 1]); Index += 2; }- } while (FALSE);++ gFitTableContext.StartupAcmNumber ++;+ gFitTableContext.FitEntryNumber ++;+ } // // 1.5. DiagnosticsAcm@@ -1890,7 +1894,9 @@ Returns: // // Final: Check StartupAcm in BiosModule. //- CheckOverlap (gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size);+ for (Index = 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index++) {+ CheckOverlap (gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].Size);+ } FitEntryNumber = gFitTableContext.FitEntryNumber; for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; Index++) { if ((gFitTableContext.OptionalModule[Index].Type == FIT_TABLE_TYPE_BIOS_POLICY) ||@@ -2178,8 +2184,8 @@ Returns: } printf ("Total FIT Entry number: 0x%x\n", gFitTableContext.FitEntryNumber); printf ("FitHeader version: 0x%04x\n", gFitTableContext.FitHeaderVersion);- if (gFitTableContext.StartupAcm.Address != 0) {- printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size, gFitTableContext.StartupAcmVersion);+ for (Index = 0; Index < gFitTableContext.StartupAcmNumber; Index++) {+ printf ("StartupAcm[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].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);@@ -2809,8 +2815,8 @@ Returns: // // 4. StartupAcm //- if (gFitTableContext.StartupAcm.Address != 0) {- FitEntry[FitIndex].Address = gFitTableContext.StartupAcm.Address;+ for (Index = 0; Index < gFitTableContext.StartupAcmNumber; Index++) {+ FitEntry[FitIndex].Address = gFitTableContext.StartupAcm[Index].Address; *(UINT32 *)&FitEntry[FitIndex].Size[0] = 0; //gFitTableContext.StartupAcm.Size / 16; FitEntry[FitIndex].Version = (UINT16)gFitTableContext.StartupAcmVersion; FitEntry[FitIndex].Type = FIT_TABLE_TYPE_STARTUP_ACM;@@ -3110,7 +3116,7 @@ GetFitEntryInfo ( Routine Description: - Fill the FIT table information to Fvrecovery+ Get the FIT table information from Fvrecovery Arguments: @@ -3164,8 +3170,8 @@ Returns: gFitTableContext.MicrocodeNumber ++; break; case FIT_TABLE_TYPE_STARTUP_ACM:- gFitTableContext.StartupAcm.Address = (UINT32)FitEntry[FitIndex].Address;- gFitTableContext.StartupAcmVersion = FitEntry[FitIndex].Version;+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)FitEntry[FitIndex].Address;+ gFitTableContext.StartupAcmVersion = FitEntry[FitIndex].Version; break; case FIT_TABLE_TYPE_BIOS_MODULE: gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Address = (UINT32)FitEntry[FitIndex].Address;@@ -3232,6 +3238,7 @@ Returns: UINT32 FdFileSize; UINT8 *AcmBuffer;+ INTN Index; UINT32 FixedFitLocation; FileBufferRaw = NULL;@@ -3323,22 +3330,23 @@ Returns: // // Get ACM buffer //- if (gFitTableContext.StartupAcm.Address != 0) {- AcmBuffer = FLASH_TO_MEMORY(gFitTableContext.StartupAcm.Address, FdFileBuffer, FdFileSize);- if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.StartupAcm.Size > FdFileBuffer + FdFileSize)) {- printf ("ACM out of range - can not validate it\n");- AcmBuffer = NULL;- }+ for (Index = 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index ++) {+ if (gFitTableContext.StartupAcm[Index].Address != 0) {+ AcmBuffer = FLASH_TO_MEMORY(gFitTableContext.StartupAcm[Index].Address, FdFileBuffer, FdFileSize);+ if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.StartupAcm[Index].Size > FdFileBuffer + FdFileSize)) {+ printf ("ACM out of range - can not validate it\n");+ AcmBuffer = NULL;+ } - if (AcmBuffer != NULL) {- if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm.Size)) {- DumpAcm ((ACM_FORMAT *)AcmBuffer);- } else {- Status = STATUS_ERROR;- goto exitFunc;+ if (AcmBuffer != NULL) {+ if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm[Index].Size)) {+ DumpAcm ((ACM_FORMAT *)AcmBuffer);+ } else {+ Status = STATUS_ERROR;+ goto exitFunc;+ } } }- } //@@ -3576,4 +3584,3 @@ Returns: return u; }-diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitGen/FitGen.h index 5add6a8870..b7de0a6b2d 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -1,7 +1,7 @@ /**@file Definitions for the FitGen utility. -Copyright (c) 2010-2020, Intel Corporation. All rights reserved.<BR>+Copyright (c) 2010-2022, Intel Corporation. All rights reserved.<BR> SPDX-License-Identifier: BSD-2-Clause-Patent **/@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information // #define UTILITY_MAJOR_VERSION 0-#define UTILITY_MINOR_VERSION 64+#define UTILITY_MINOR_VERSION 65 #define UTILITY_DATE __DATE__ //-- 2.37.0.windows.1
|
|