* [PATCH v1 1/2] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool
@ 2022-06-23 14:35 Lin, Jason1
2022-06-23 14:35 ` [PATCH v1 2/2] [edk2-platforms] Silicon/Intel/FitGen: Support to override the MBZ byte in Startup ACM entries for other usages Lin, Jason1
0 siblings, 1 reply; 2+ messages in thread
From: Lin, Jason1 @ 2022-06-23 14:35 UTC (permalink / raw)
To: devel; +Cc: Jason1 Lin, Bob Feng, Liming Gao, Yuwei Chen, Dakota Chiang
From: Jason1 Lin <jason1.lin@intel.com>
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@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Dakota Chiang <dakota.chiang@intel.com>
---
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.26.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v1 2/2] [edk2-platforms] Silicon/Intel/FitGen: Support to override the MBZ byte in Startup ACM entries for other usages
2022-06-23 14:35 [PATCH v1 1/2] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool Lin, Jason1
@ 2022-06-23 14:35 ` Lin, Jason1
0 siblings, 0 replies; 2+ messages in thread
From: Lin, Jason1 @ 2022-06-23 14:35 UTC (permalink / raw)
To: devel; +Cc: Jason1 Lin, Bob Feng, Liming Gao, Yuwei Chen, Dakota Chiang
From: Jason1 Lin <jason1.lin@intel.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3959
As per FIT BIOS Specification 1.2 Rules, the size bytes (3 bytes)/
reserved byte (1 byte) / CheckSum byte (1 byte) in type 2 are must-be-zero (MBZ).
These bytes could be override for the other usages.
In the future, if these bytes field have other meanings, there would be no need to change the FitGen.
Command:
[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>]
[-I <StartupAcmSizeByte0 StartupAcmSizeByte1 StartupAcmSizeByte2 StartupAcmRsvd StartupAcmChksum>]
[-V <StartupAcmVersion>]
With "-I" input the default Type 2 entry version would be 0x200.
Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Dakota Chiang <dakota.chiang@intel.com>
---
Silicon/Intel/Tools/FitGen/FitGen.c | 105 ++++++++++++++++----
Silicon/Intel/Tools/FitGen/FitGen.h | 2 +-
2 files changed, 88 insertions(+), 19 deletions(-)
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitGen/FitGen.c
index eac8fa8715..bdda8dfd5a 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.c
+++ b/Silicon/Intel/Tools/FitGen/FitGen.c
@@ -210,6 +210,7 @@ typedef struct {
#define DEFAULT_FIT_TABLE_POINTER_OFFSET 0x40
#define DEFAULT_FIT_ENTRY_VERSION 0x0100
+#define STARTUP_ACM_FIT_ENTRY_200_VERSION 0x0200
#define TOP_FLASH_ADDRESS (gFitTableContext.TopFlashAddressRemapValue)
@@ -247,6 +248,12 @@ typedef struct {
UINT8 *Buffer; // Used by OptionalModule only
UINT32 Size;
UINT32 Version; // Used by OptionalModule and PortModule only
+ UINT32 MaxSize;
+ UINT8 SizeByte0; // Used by S-ACM only
+ UINT8 SizeByte1; // Used by S-ACM only
+ UINT8 SizeByte2; // Used by S-ACM only
+ UINT8 Rsvd; // Used by S-ACM only
+ UINT8 ChkSum; // Used by S-ACM only
} FIT_TABLE_CONTEXT_ENTRY;
typedef struct {
@@ -262,7 +269,7 @@ typedef struct {
UINT32 GlobalVersion;
UINT32 FitHeaderVersion;
FIT_TABLE_CONTEXT_ENTRY StartupAcm[MAX_STARTUP_ACM_ENTRY];
- UINT32 StartupAcmVersion;
+ UINT32 StartupAcmVersion[MAX_STARTUP_ACM_ENTRY];
FIT_TABLE_CONTEXT_ENTRY DiagnstAcm;
UINT32 DiagnstAcmVersion;
FIT_TABLE_CONTEXT_ENTRY BiosModule[MAX_BIOS_MODULE_ENTRY];
@@ -341,7 +348,7 @@ Returns:
"\t[-L <MicrocodeSlotSize> <MicrocodeFfsGuid>]\n"
"\t[-LF <MicrocodeSlotSize>]\n"
"\t[-I <BiosInfoGuid>]\n"
- "\t[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>] [-V <StartupAcmVersion>]\n"
+ "\t[-S <StartupAcmAddress StartupAcmSize>|<StartupAcmGuid>] [-I <StartupAcmSizeByte0 StartupAcmSizeByte1 StartupAcmSizeByte2 StartupAcmRsvd StartupAcmChksum>] [-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"
@@ -357,7 +364,13 @@ Returns:
printf ("\tBiosInfoGuid - Guid of BiosInfo Module. If this module exists, StartupAcm/Bios/Microcode can be optional.\n");
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 ("\tStartupAcmGuid - Guid of StartupAcm Module.\n");
+ printf ("\tStartupAcmMaxSize - The maximum size value that could place the StartupAcm in.\n");
+ printf ("\tStartupAcmSizeByte0 - The value for Size byte 0 (Override default value).\n");
+ printf ("\tStartupAcmSizeByte1 - The value for Size byte 1 (Override default value).\n");
+ printf ("\tStartupAcmSizeByte2 - The value for Size byte 2 (Override default value).\n");
+ printf ("\tStartupAcmRsvd - The value for Reserved byte (Override default value).\n");
+ printf ("\tStartupAcmChkSum - The value for CheckSum byte (Override default value).\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");
@@ -913,6 +926,9 @@ Returns:
UINT32 FileSize;
UINT32 Type;
UINT32 SubType;
+ UINT8 StartupAcmSizeByte0;
+ UINT8 StartupAcmSizeByte1;
+ UINT8 StartupAcmSizeByte2;
UINT8 *MicrocodeFileBuffer;
UINT8 *MicrocodeFileBufferRaw;
UINT32 MicrocodeFileSize;
@@ -1155,9 +1171,12 @@ Returns:
Error (NULL, 0, 0, "-I Parameter incorrect, too many StartupAcm!", NULL);
return 0;
}
+ //
+ // NOTE: BIOS INFO structure not support to override the Size/Rsvd/ChkSum byte value.
+ //
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].MaxSize = (UINT32)BiosInfoStruct[BiosInfoIndex].Size;
gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Version = BiosInfoStruct[BiosInfoIndex].Version;
gFitTableContext.StartupAcmNumber ++;
gFitTableContext.FitEntryNumber ++;
@@ -1389,10 +1408,52 @@ Returns:
}
gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FIT_TABLE_TYPE_STARTUP_ACM;
gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32) (UINTN) FileBuffer;
- gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = FileSize;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].MaxSize = FileSize;
//
- // 1.1 StartupAcm version
+ // 1.1 Support 0x200 StartupAcm Information
+ //
+ if ((Index + 1 >= argc) ||
+ ((strcmp (argv[Index], "-I") != 0) &&
+ (strcmp (argv[Index], "-i") != 0)) ) {
+ //
+ // Bypass
+ //
+ gFitTableContext.StartupAcmVersion[gFitTableContext.StartupAcmNumber] = gFitTableContext.GlobalVersion;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = 0;
+ } else {
+ //
+ // Should use the multiple StartupACM
+ //
+ if (Index + 5 >= argc) {
+ //
+ // Should get five input value, but not sufficient
+ //
+ Error (NULL, 0, 0, "-I Parameter incorrect, Require five inputs value!", NULL);
+ return 0;
+ } else {
+ //
+ // Should assign this as 0x200
+ //
+ gFitTableContext.StartupAcmVersion[gFitTableContext.StartupAcmNumber] = STARTUP_ACM_FIT_ENTRY_200_VERSION;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte0 = (UINT8)xtoi (argv[Index + 1]);
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte1 = (UINT8)xtoi (argv[Index + 2]);
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte2 = (UINT8)xtoi (argv[Index + 3]);
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Rsvd = (UINT8)xtoi (argv[Index + 4]);
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].ChkSum = (UINT8)xtoi (argv[Index + 5]);
+
+ StartupAcmSizeByte0 = (UINT32)gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte0;
+ StartupAcmSizeByte1 = (UINT32)gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte1;
+ StartupAcmSizeByte2 = (UINT32)gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte2;
+
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = (StartupAcmSizeByte2 << 16) + (StartupAcmSizeByte1 << 8) + (StartupAcmSizeByte0);
+
+ Index += 6;
+ }
+ }
+
+ //
+ // 1.2 StartupAcm version
//
if ((Index + 1 >= argc) ||
((strcmp (argv[Index], "-V") != 0) &&
@@ -1400,18 +1461,17 @@ Returns:
//
// Bypass
//
- gFitTableContext.StartupAcmVersion = gFitTableContext.GlobalVersion;
} else {
//
// Get offset from parameter
//
- gFitTableContext.StartupAcmVersion = xtoi (argv[Index + 1]);
+ gFitTableContext.StartupAcmVersion[gFitTableContext.StartupAcmNumber] = xtoi (argv[Index + 1]);
Index += 2;
}
gFitTableContext.StartupAcmNumber ++;
gFitTableContext.FitEntryNumber ++;
- }
+ };
//
// 1.5. DiagnosticsAcm
@@ -1895,7 +1955,7 @@ Returns:
// Final: Check StartupAcm in BiosModule.
//
for (Index = 0; Index < (INTN)gFitTableContext.StartupAcmNumber; Index++) {
- CheckOverlap (gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].Size);
+ CheckOverlap (gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].MaxSize);
}
FitEntryNumber = gFitTableContext.FitEntryNumber;
for (Index = 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; Index++) {
@@ -2185,7 +2245,7 @@ Returns:
printf ("Total FIT Entry number: 0x%x\n", gFitTableContext.FitEntryNumber);
printf ("FitHeader version: 0x%04x\n", gFitTableContext.FitHeaderVersion);
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);
+ printf ("StartupAcm[%d] - (0x%08x, 0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTableContext.StartupAcm[Index].Address, gFitTableContext.StartupAcm[Index].Size, gFitTableContext.StartupAcm[Index].MaxSize, gFitTableContext.StartupAcmVersion[Index]);
}
if (gFitTableContext.DiagnstAcm.Address != 0) {
printf ("DiagnosticAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size, gFitTableContext.DiagnstAcmVersion);
@@ -2817,11 +2877,12 @@ Returns:
//
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;
+ *(UINT32 *)&FitEntry[FitIndex].Size[0] = gFitTableContext.StartupAcm[Index].Size;
+ FitEntry[FitIndex].Version = (UINT16)gFitTableContext.StartupAcmVersion[Index];
FitEntry[FitIndex].Type = FIT_TABLE_TYPE_STARTUP_ACM;
FitEntry[FitIndex].C_V = 0;
- FitEntry[FitIndex].Checksum = 0;
+ FitEntry[FitIndex].Rsvd = gFitTableContext.StartupAcm[Index].Rsvd;
+ FitEntry[FitIndex].Checksum = gFitTableContext.StartupAcm[Index].ChkSum;
FitIndex++;
}
@@ -3170,8 +3231,16 @@ Returns:
gFitTableContext.MicrocodeNumber ++;
break;
case FIT_TABLE_TYPE_STARTUP_ACM:
- gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)FitEntry[FitIndex].Address;
- gFitTableContext.StartupAcmVersion = FitEntry[FitIndex].Version;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Address = (UINT32)FitEntry[FitIndex].Address;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Type = FitEntry[FitIndex].Type;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Size = *(UINT32 *)&FitEntry[FitIndex].Size[0];
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte0 = *(UINT8 *)&FitEntry[FitIndex].Size[0];
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte1 = *(UINT8 *)&FitEntry[FitIndex].Size[1];
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].SizeByte2 = *(UINT8 *)&FitEntry[FitIndex].Size[2];
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].Rsvd = FitEntry[FitIndex].Rsvd;
+ gFitTableContext.StartupAcm[gFitTableContext.StartupAcmNumber].ChkSum = FitEntry[FitIndex].Checksum;
+ gFitTableContext.StartupAcmVersion[gFitTableContext.StartupAcmNumber] = FitEntry[FitIndex].Version;
+ gFitTableContext.StartupAcmNumber ++;
break;
case FIT_TABLE_TYPE_BIOS_MODULE:
gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Address = (UINT32)FitEntry[FitIndex].Address;
@@ -3333,13 +3402,13 @@ Returns:
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)) {
+ if ((AcmBuffer < FdFileBuffer) || (AcmBuffer + gFitTableContext.StartupAcm[Index].MaxSize > FdFileBuffer + FdFileSize)) {
printf ("ACM out of range - can not validate it\n");
AcmBuffer = NULL;
}
if (AcmBuffer != NULL) {
- if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm[Index].Size)) {
+ if (CheckAcm ((ACM_FORMAT *)AcmBuffer, gFitTableContext.StartupAcm[Index].MaxSize)) {
DumpAcm ((ACM_FORMAT *)AcmBuffer);
} else {
Status = STATUS_ERROR;
diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitGen/FitGen.h
index b7de0a6b2d..80a1423ceb 100644
--- a/Silicon/Intel/Tools/FitGen/FitGen.h
+++ b/Silicon/Intel/Tools/FitGen/FitGen.h
@@ -31,7 +31,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
// Utility version information
//
#define UTILITY_MAJOR_VERSION 0
-#define UTILITY_MINOR_VERSION 65
+#define UTILITY_MINOR_VERSION 66
#define UTILITY_DATE __DATE__
//
--
2.26.2.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-23 14:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-23 14:35 [PATCH v1 1/2] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool Lin, Jason1
2022-06-23 14:35 ` [PATCH v1 2/2] [edk2-platforms] Silicon/Intel/FitGen: Support to override the MBZ byte in Startup ACM entries for other usages Lin, Jason1
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox