Re: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool

2022-07-05 Thread Bob Feng
This patch series was pushed.

Thanks,
Bob

-Original Message-
From: Lin, Jason1  
Sent: Friday, July 1, 2022 11:10 PM
To: devel@edk2.groups.io
Cc: Lin, Jason1 ; Feng, Bob C ; 
Gao, Liming ; Chen, Christine ; 
Oram, Isaac W ; Chaganty, Rangasai V 
; Chiang, Dakota 
Subject: [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple 
Startup ACM Type 2 entries in FitGen tool

From: 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 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Cc: Isaac W Oram 
Cc: Rangasai V Chaganty 
Cc: 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.+Copyright 
(c) 2010-2022, Intel Corporation. All rights reserved. 
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_ENTRYStartupAcm;+  
FIT_TABLE_CONTEXT_ENTRYStartupAcm[MAX_STARTUP_ACM_ENTRY];   UINT32  
   StartupAcmVersion;   FIT_TABLE_CONTEXT_ENTRYDiagnstAcm;   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], )) 
{@@ -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;-

Re: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool

2022-07-03 Thread Yuwei Chen
Reviewed-by: Yuwei Chen

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of Lin,
> Jason1
> Sent: Friday, July 1, 2022 11:10 PM
> To: devel@edk2.groups.io
> Cc: Lin, Jason1 ; Feng, Bob C ;
> Gao, Liming ; Chen, Christine
> ; Oram, Isaac W ;
> Chaganty, Rangasai V ; Chiang, Dakota
> 
> Subject: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen:
> Support multiple Startup ACM Type 2 entries in FitGen tool
> 
> From: 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 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Cc: Yuwei Chen 
> Cc: Isaac W Oram 
> Cc: Rangasai V Chaganty 
> Cc: 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.+Copyright (c) 2010-2022, Intel Corporation. All rights
> reserved. SPDX-License-Identifier: BSD-2-Clause-Patent  **/@@ -204,6
> +204,7 @@ typedef struct {
>   #define MAX_BIOS_MODULE_ENTRY  0x20 #define
> MAX_MICROCODE_ENTRY0x20+#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_ENTRYStartupAcm;+
> FIT_TABLE_CONTEXT_ENTRYStartupAcm[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], )) {@@ -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) 

Re: [edk2-devel] [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple Startup ACM Type 2 entries in FitGen tool

2022-07-01 Thread Oram, Isaac W
Reviewed-by: Isaac W Oram 

-Original Message-
From: Lin, Jason1  
Sent: Friday, July 1, 2022 8:10 AM
To: devel@edk2.groups.io
Cc: Lin, Jason1 ; Feng, Bob C ; 
Gao, Liming ; Chen, Christine ; 
Oram, Isaac W ; Chaganty, Rangasai V 
; Chiang, Dakota 
Subject: [PATCH v3 1/3] [edk2-platforms] Silicon/Intel/FitGen: Support multiple 
Startup ACM Type 2 entries in FitGen tool

From: 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 
Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yuwei Chen 
Cc: Isaac W Oram 
Cc: Rangasai V Chaganty 
Cc: 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.+Copyright 
(c) 2010-2022, Intel Corporation. All rights reserved. 
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_ENTRYStartupAcm;+  
FIT_TABLE_CONTEXT_ENTRYStartupAcm[MAX_STARTUP_ACM_ENTRY];   UINT32  
   StartupAcmVersion;   FIT_TABLE_CONTEXT_ENTRYDiagnstAcm;   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], )) 
{@@ -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)