From nobody Mon May 6 20:07:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+48938+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48938+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1571095465; cv=none; d=zoho.com; s=zohoarc; b=okwMab7NpM313HbG2GBIAtfseGaSPdiHhXChQt9Jub8C/4DmPyuJVuw+1MT+JsSejZo5mne0H/uzomXnY2wsfm0ZPsMqejR9jKSMwuJYA1pdHLO/yGhn6COGoCOdQZ39Wtv3etZW8sVPNt8lZvikjf9lXNgkb/WlZqfSpJA7pFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571095465; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=tPDOd3Y3nU4cGSTxUMEiD4Hvw4FhKTyr646yoD48nkk=; b=m171Ad/VjnOjp+cUKjk5sop00cy84d3wNe1qIw+uwabHxX2W7saPYy7fT5tajcUc1vS7FAdnOTwGH7cEioIDaxbwv//xKfjEYMiCzuMrTjLQlMfDI7nlYWDlADjlCjffcxaoGDOD7eTS/GOXLGybrWCfane6vZpqxA2NCAOfjm8= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+48938+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1571095465930194.69792532292138; Mon, 14 Oct 2019 16:24:25 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id WiwjYY1788612xpqyG7ChQ1t; Mon, 14 Oct 2019 16:24:25 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web12.1545.1571095464730222761 for ; Mon, 14 Oct 2019 16:24:24 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 16:24:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="396627155" X-Received: from sagraw2-desk1.amr.corp.intel.com ([134.134.154.163]) by fmsmga006.fm.intel.com with ESMTP; 14 Oct 2019 16:24:23 -0700 From: "Agrawal, Sachin" To: devel@edk2.groups.io Cc: "Agrawal, Sachin" , Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH] Add support for FuSA ACM in FitGen tool Date: Mon, 14 Oct 2019 16:23:38 -0700 Message-Id: Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sachin.agrawal@intel.com X-Gm-Message-State: VesV31Y6GPQnf0if7dO6GBenx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1571095465; bh=iRG6SbBuVkGQbqKtVbOQy86y659z28tU1Yv4eZm3XuI=; h=Cc:Date:From:Reply-To:Subject:To; b=dzUyT6AcQkcgA3T578MEzTqL9lZKN3JeWFPjGZq/zlYcFvh7Tn962rJkI+KpKrhZig5 6MaWuJXwY8dwOr4GAeidIH73rZMG0J7F8x5dcHZb24HLzr+SstZ53sdSQapSL6Lv4wE8m QGYCMYYJCXThBYq4gl+gnjxyKVqpaphy3XQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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/FitG= en/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 ||] [-V ]\n" "\t[-O RecordType ||| [-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 Startu= pAcm 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 i= s in a BiosModule, it will be excluded from that.\n"); printf ("\tBiosModuleAddress - Address of BiosModule. User should e= nsure 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 tabl= e entries. 0x%04x is used if this is not specified.\n", DEFAULT_FIT_ENTRY_V= ERSION); printf ("\tFitHeaderVersion - The version for FIT header. (Overrid= e default version)\n"); printf ("\tStartupAcmVersion - The version for StartupAcm. (Overrid= e default version)\n"); + printf ("\tFusaAcmVersion - The version for FusaAcm. (Override d= efault version)\n"); printf ("\tBiosModuleVersion - The version for BiosModule. (Overrid= e default version)\n"); printf ("\tMicrocodeVersion - The version for Microcode. (Override= default version)\n"); printf ("\tRecordVersion - The version for Record. (Override de= fault version)\n"); @@ -953,6 +961,17 @@ Returns: gFitTableContext.StartupAcmVersion =3D BiosInfoStruct[BiosInfoI= ndex].Version; gFitTableContext.FitEntryNumber ++; break; + case FIT_TABLE_TYPE_FUSA_ACM: + if (gFitTableContext.FusaAcm.Type !=3D 0) { + Error (NULL, 0, 0, "-I Parameter incorrect, Duplicated FusaAcm= !", NULL); + return 0; + } + gFitTableContext.FusaAcm.Type =3D FIT_TABLE_TYPE_FUSA_ACM; + gFitTableContext.FusaAcm.Address =3D (UINT32)BiosInfoStruct[Bios= InfoIndex].Address; + gFitTableContext.FusaAcm.Size =3D (UINT32)BiosInfoStruct[Bios= InfoIndex].Size; + gFitTableContext.FusaAcmVersion =3D BiosInfoStruct[BiosInfoInde= x].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); =20 // + // 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, &FileS= ize); + 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, FdSiz= e); + 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!", NU= LL); + 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.Star= tupAcm.Size); + CheckOverlap (gFitTableContext.FusaAcm.Address, gFitTableContext.FusaAcm= .Size); FitEntryNumber =3D gFitTableContext.FitEntryNumber; for (Index =3D 0; Index < (INTN)gFitTableContext.OptionalModuleNumber; I= ndex++) { 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.St= artupAcm.Address, gFitTableContext.StartupAcm.Size, gFitTableContext.Startu= pAcmVersion); } + if (gFitTableContext.FusaAcm.Address !=3D 0) { + printf ("FusaAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext.FusaA= cm.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, gFitTabl= eContext.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++; } =20 + // + // 4.5. FuSaAcm + // + if (gFitTableContext.FusaAcm.Address !=3D 0) { + FitEntry[FitIndex].Address =3D gFitTableContext.FusaAcm.Ad= dress; + *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0; + FitEntry[FitIndex].Version =3D (UINT16)gFitTableContext.Fu= saAcmVersion; + FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_FUSA_ACM; + FitEntry[FitIndex].C_V =3D 0; + FitEntry[FitIndex].Checksum =3D 0; + FitIndex++; + } // // 5. BiosModule // --=20 2.14.3.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48938): https://edk2.groups.io/g/devel/message/48938 Mute This Topic: https://groups.io/mt/34540023/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-