From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.1993.1571099069786822596 for ; Mon, 14 Oct 2019 17:24:29 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: liming.gao@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 17:24:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="199561482" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 14 Oct 2019 17:24:28 -0700 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 14 Oct 2019 17:24:28 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 14 Oct 2019 17:24:28 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.33]) with mapi id 14.03.0439.000; Tue, 15 Oct 2019 08:24:26 +0800 From: "Liming Gao" To: "Agrawal, Sachin" , "devel@edk2.groups.io" CC: "Feng, Bob C" Subject: Re: [PATCH] Add support for FuSA ACM in FitGen tool Thread-Topic: [PATCH] Add support for FuSA ACM in FitGen tool Thread-Index: AQHVguaGKCJvIToXfEqYgeOgtiwFNada16lg Date: Tue, 15 Oct 2019 00:24:25 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E517084@SHSMSX104.ccr.corp.intel.com> References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: liming.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable As you know, FitGen is used to generate firmware interface table. This tabl= e is defined in public specification. Can you let me whether this new entry is defined in the latest FitGen spec?= =20 Thanks Liming >-----Original Message----- >From: Agrawal, Sachin >Sent: Tuesday, October 15, 2019 7:24 AM >To: devel@edk2.groups.io >Cc: Agrawal, Sachin ; Feng, Bob C >; Gao, Liming >Subject: [PATCH] Add support for FuSA ACM in FitGen tool > >REF https://bugzilla.tianocore.org/show_bug.cgi?id=3D2200 > >FitGen Tool is responsible for creating FIT table in UEFI BIOS. >A new FIT entry type (FIT Type 0x3) has been allocated for FuSa ACM. >FitGen tool is updated to add support for this FuSa ACM. > >Cc: Bob Feng >Cc: Liming Gao > >Signed-off-by: Sachin Agrawal >--- > Silicon/Intel/Tools/FitGen/FitGen.c | 82 >+++++++++++++++++++++++++++++++++++++ > 1 file changed, 82 insertions(+) > >diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c >b/Silicon/Intel/Tools/FitGen/FitGen.c >index faf9880060..1ebce40505 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_FUSA_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 FusaAcm; >+ UINT32 FusaAcmVersion; > FIT_TABLE_CONTEXT_ENTRY BiosModule[MAX_BIOS_MODULE_ENTRY]; > UINT32 BiosModuleVersion; > FIT_TABLE_CONTEXT_ENTRY Microcode[MAX_MICROCODE_ENTRY]; >@@ -317,6 +320,7 @@ Returns: > "\t[-CLEAR]\n" > "\t[-I ]\n" > "\t[-S |] [-V >]\n" >+ "\t[-F |] [-V >]\n" > "\t[-B ] [-B ...] [-V >]\n" > "\t[-M ] [-M ...]|[-U MicrocodeBase>|MicrocodeRegionSize>|] [-V ]\n" > "\t[-O RecordType |RecordDataSize>|| [-V ]] >[-O ... [-V ...]]\n" >@@ -331,6 +335,9 @@ Returns: > printf ("\tStartupAcmAddress - Address of StartupAcm.\n"); > printf ("\tStartupAcmSize - Size of StartupAcm.\n"); > printf ("\tStartupAcmGuid - Guid of StartupAcm Module, if Start= upAcm >is in a BiosModule, it will be excluded form that.\n"); >+ printf ("\tFusaAcmAddress - Address of FusaAcm.\n"); >+ printf ("\tFusaAcmSize - Size of FusaAcm.\n"); >+ printf ("\tFusaAcmGuid - Guid of FusaAcm Module, if FusaAcm = 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"); >@@ -349,6 +356,7 @@ Returns: > printf ("\tFitEntryDefaultVersion - The default version for all FIT tab= le entries. >0x%04x is used if this is not specified.\n", DEFAULT_FIT_ENTRY_VERSION); > printf ("\tFitHeaderVersion - The version for FIT header. (Overri= de >default version)\n"); > printf ("\tStartupAcmVersion - The version for StartupAcm. (Overri= de >default version)\n"); >+ printf ("\tFusaAcmVersion - The version for FusaAcm. (Override = default >version)\n"); > printf ("\tBiosModuleVersion - The version for BiosModule. (Overri= de >default version)\n"); > printf ("\tMicrocodeVersion - The version for Microcode. (Overrid= e >default version)\n"); > printf ("\tRecordVersion - The version for Record. (Override d= efault >version)\n"); >@@ -953,6 +961,17 @@ Returns: > gFitTableContext.StartupAcmVersion =3D >BiosInfoStruct[BiosInfoIndex].Version; > gFitTableContext.FitEntryNumber ++; > break; >+ case FIT_TABLE_TYPE_FUSA_ACM: >+ if (gFitTableContext.FusaAcm.Type !=3D 0) { >+ Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated FusaAc= m!", NULL); >+ return 0; >+ } >+ gFitTableContext.FusaAcm.Type =3D FIT_TABLE_TYPE_FUSA_ACM; >+ gFitTableContext.FusaAcm.Address =3D >(UINT32)BiosInfoStruct[BiosInfoIndex].Address; >+ gFitTableContext.FusaAcm.Size =3D >(UINT32)BiosInfoStruct[BiosInfoIndex].Size; >+ gFitTableContext.FusaAcmVersion =3D >BiosInfoStruct[BiosInfoIndex].Version; >+ gFitTableContext.FitEntryNumber ++; >+ break; > case FIT_TABLE_TYPE_BIOS_MODULE: > if ((BiosInfoStruct[BiosInfoIndex].Attributes & >BIOS_INFO_STRUCT_ATTRIBUTE_BIOS_POST_IBB) !=3D 0) { > continue; >@@ -1148,6 +1167,52 @@ Returns: > } while (FALSE); > > // >+ // 1.5. FusaAcm >+ // >+ do { >+ if ((Index + 1 >=3D argc) || >+ ((strcmp (argv[Index], "-F") !=3D 0) && >+ (strcmp (argv[Index], "-f") !=3D 0)) ) { >+ if (BiosInfoExist && (gFitTableContext.FusaAcm.Type =3D=3D >FIT_TABLE_TYPE_FUSA_ACM)) { >+ break; >+ } >+ break; >+ } >+ if (IsGuidData (argv[Index + 1], &Guid)) { >+ FileBuffer =3D FindFileFromFvByGuid (FdBuffer, FdSize, &Guid, &File= Size); >+ if (FileBuffer =3D=3D NULL) { >+ Error (NULL, 0, 0, "-F Parameter incorrect, GUID not found!", "%s= ", >argv[Index + 1]); >+ return 0; >+ } >+ FileBuffer =3D (UINT8 *)MEMORY_TO_FLASH (FileBuffer, FdBuffer, FdSi= ze); >+ Index +=3D 2; >+ } else { >+ if (Index + 2 >=3D argc) { >+ Error (NULL, 0, 0, "-F Parameter incorrect, expect Address Size!"= , NULL); >+ return 0; >+ } >+ FileBuffer =3D (UINT8 *) (UINTN) xtoi (argv[Index + 1]); >+ FileSize =3D xtoi (argv[Index + 2]); >+ Index +=3D 3; >+ } >+ if (gFitTableContext.FusaAcm.Type !=3D 0) { >+ Error (NULL, 0, 0, "-F Parameter incorrect, Duplicated FusaAcm!", N= ULL); >+ return 0; >+ } >+ gFitTableContext.FusaAcm.Type =3D FIT_TABLE_TYPE_FUSA_ACM; >+ gFitTableContext.FusaAcm.Address =3D (UINT32) (UINTN) FileBuffer; >+ gFitTableContext.FusaAcm.Size =3D FileSize; >+ gFitTableContext.FitEntryNumber ++; >+ if ((Index + 1 >=3D argc) || >+ ((strcmp (argv[Index], "-V") !=3D 0) && >+ (strcmp (argv[Index], "-v") !=3D 0)) ) { >+ gFitTableContext.FusaAcmVersion =3D gFitTableContext.GlobalVersion; >+ } else { >+ gFitTableContext.FusaAcmVersion =3D xtoi (argv[Index + 1]); >+ Index +=3D 2; >+ } >+ } while (FALSE); >+ > // 2. BiosModule > // > do { >@@ -1555,6 +1620,7 @@ Returns: > // Final: Check StartupAcm in BiosModule. > // > CheckOverlap (gFitTableContext.StartupAcm.Address, >gFitTableContext.StartupAcm.Size); >+ CheckOverlap (gFitTableContext.FusaAcm.Address, >gFitTableContext.FusaAcm.Size); > FitEntryNumber =3D gFitTableContext.FitEntryNumber; > for (Index =3D 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; >Index++) { > if ((gFitTableContext.OptionalModule[Index].Type =3D=3D >FIT_TABLE_TYPE_BIOS_POLICY) || >@@ -1821,6 +1887,9 @@ Returns: > if (gFitTableContext.StartupAcm.Address !=3D 0) { > printf ("StartupAcm - (0x%08x, 0x%08x, 0x%04x)\n", >gFitTableContext.StartupAcm.Address, gFitTableContext.StartupAcm.Size, >gFitTableContext.StartupAcmVersion); > } >+ if (gFitTableContext.FusaAcm.Address !=3D 0) { >+ printf ("FusaAcm - (0x%08x, 0x%08x, 0x%04x)\n", >gFitTableContext.FusaAcm.Address, gFitTableContext.FusaAcm.Size, >gFitTableContext.FusaAcmVersion); >+ } > for (Index =3D 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); > } >@@ -1845,6 +1914,7 @@ CHAR8 *mFitTypeStr[] =3D { > " ", > "MICROCODE ", > "STARTUP_ACM", >+ "FUSA_ACM ", > " ", > " ", > " ", >@@ -2413,6 +2483,18 @@ Returns: > FitIndex++; > } > >+ // >+ // 4.5. FuSaAcm >+ // >+ if (gFitTableContext.FusaAcm.Address !=3D 0) { >+ FitEntry[FitIndex].Address =3D gFitTableContext.FusaAcm.A= ddress; >+ *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0; >+ FitEntry[FitIndex].Version =3D >(UINT16)gFitTableContext.FusaAcmVersion; >+ FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_FUSA_ACM; >+ FitEntry[FitIndex].C_V =3D 0; >+ FitEntry[FitIndex].Checksum =3D 0; >+ FitIndex++; >+ } > // > // 5. BiosModule > // >-- >2.14.3.windows.1