From nobody Sat Apr 20 11:10:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54091+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54091+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1581114737911129.75051038880133; Fri, 7 Feb 2020 14:32:17 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 624rYY1788612xSWXC9Bp2F9; Fri, 07 Feb 2020 14:32:17 -0800 X-Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.12537.1581114736330399676 for ; Fri, 07 Feb 2020 14:32:16 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2020 14:32:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,415,1574150400"; d="scan'208";a="265172969" X-Received: from sagraw2-desk1.amr.corp.intel.com ([134.134.154.163]) by fmsmga002.fm.intel.com with ESMTP; 07 Feb 2020 14:32:15 -0800 From: "Agrawal, Sachin" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH v2] Add support for Diagnostics ACM in FitGen tool Date: Fri, 7 Feb 2020 14:32:13 -0800 Message-Id: <20200207223213.28608-1-sachin.agrawal@intel.com> 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: nJTjM6iTvJPKP2wVIV48vocOx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1581114737; bh=DOlC9AotJF5/n1eIaBnEZPeIHXYHV0WLMk/ufYbXYxA=; h=Cc:Date:From:Reply-To:Subject:To; b=cUspBpix16BQsifzjWLtUudlAu1jGsCF+sXemWBqJsv6vNvXqxEN26cRcG2IgiuVjfS qwF8NmhWx8vOtUE6maZ0PL2AB3ee30wmKed6xYje5xNygfxiL/iT6gnkf6yzRwowxil2J WlQXZcJBwRapHaL18pigE12yQjStkSiQfWc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Agrawal, Sachin" 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 Diagnsotics ACM. FitGen tool is updated to add support for this Diagnostics ACM. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Sachin Agrawal Reviewed-by: Liming Gao --- Notes: v2: -Remove CheckOverlap call for Diagnostics ACM -Updated Minor version to 59 Silicon/Intel/Tools/FitGen/FitGen.c | 67 ++++++++++++++++++++ Silicon/Intel/Tools/FitGen/FitGen.h | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 5f5638dc8b..8122c10ebb 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_DIAGNST_ACM 3 #define FIT_TABLE_TYPE_BIOS_MODULE 7 #define FIT_TABLE_TYPE_TPM_POLICY 8 #define FIT_TABLE_TYPE_BIOS_POLICY 9 @@ -254,6 +255,8 @@ typedef struct { UINT32 FitHeaderVersion; FIT_TABLE_CONTEXT_ENTRY StartupAcm; UINT32 StartupAcmVersion; + FIT_TABLE_CONTEXT_ENTRY DiagnstAcm; + UINT32 DiagnstAcmVersion; FIT_TABLE_CONTEXT_ENTRY BiosModule[MAX_BIOS_MODULE_ENTRY]; UINT32 BiosModuleVersion; FIT_TABLE_CONTEXT_ENTRY Microcode[MAX_MICROCODE_ENTRY]; @@ -326,6 +329,7 @@ Returns: "\t[-L ]\n" "\t[-I ]\n" "\t[-S |] [-V = ]\n" + "\t[-U |]\n" "\t[-B ] [-B ...] [-V ]\n" "\t[-M ] [-M ...]|[-U ||] [-V ]\n" "\t[-O RecordType ||| [-V ]] [-O ..= . [-V ...]]\n" @@ -340,6 +344,8 @@ 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 ("\tDiagnstAcmAddress - Address of DiagnstAcm.\n"); + printf ("\tDiagnstAcmGuid - Guid of DiagnstAcm Module, if Diagns= tAcm is 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"); @@ -1029,6 +1035,17 @@ Returns: gFitTableContext.StartupAcmVersion =3D BiosInfoStruct[BiosInfoI= ndex].Version; gFitTableContext.FitEntryNumber ++; break; + case FIT_TABLE_TYPE_DIAGNST_ACM: + if (gFitTableContext.DiagnstAcm.Type !=3D 0) { + Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated Diagnos= ticsAcm!", NULL); + return 0; + } + gFitTableContext.DiagnstAcm.Type =3D FIT_TABLE_TYPE_DIAGNST_A= CM; + gFitTableContext.DiagnstAcm.Address =3D (UINT32)BiosInfoStruct[B= iosInfoIndex].Address; + gFitTableContext.DiagnstAcm.Size =3D 0; + gFitTableContext.DiagnstAcmVersion =3D DEFAULT_FIT_ENTRY_VERSIO= N; + gFitTableContext.FitEntryNumber ++; + break; case FIT_TABLE_TYPE_BIOS_MODULE: if ((BiosInfoStruct[BiosInfoIndex].Attributes & BIOS_INFO_STRUCT= _ATTRIBUTE_BIOS_POST_IBB) !=3D 0) { continue; @@ -1261,6 +1278,40 @@ Returns: } while (FALSE); =20 // + // 1.5. DiagnosticsAcm + // + do { + if ((Index + 1 >=3D argc) || + ((strcmp (argv[Index], "-U") !=3D 0) && + (strcmp (argv[Index], "-u") !=3D 0)) ) { + if (BiosInfoExist && (gFitTableContext.DiagnstAcm.Type =3D=3D FIT_TA= BLE_TYPE_DIAGNST_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, "-U 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 { + FileBuffer =3D (UINT8 *) (UINTN) xtoi (argv[Index + 1]); + Index +=3D 2; + } + if (gFitTableContext.DiagnstAcm.Type !=3D 0) { + Error (NULL, 0, 0, "-U Parameter incorrect, Duplicated DiagnosticsAc= m!", NULL); + return 0; + } + gFitTableContext.DiagnstAcm.Type =3D FIT_TABLE_TYPE_DIAGNST_ACM; + gFitTableContext.DiagnstAcm.Address =3D (UINT32) (UINTN) FileBuffer; + gFitTableContext.DiagnstAcm.Size =3D 0; + gFitTableContext.FitEntryNumber ++; + gFitTableContext.DiagnstAcmVersion =3D DEFAULT_FIT_ENTRY_VERSION; + } while (FALSE); + // 2. BiosModule // do { @@ -1933,6 +1984,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.DiagnstAcm.Address !=3D 0) { + printf ("DiagnosticAcm - (0x%08x, 0x%08x, 0x%04x)\n", gFitTableContext= .DiagnstAcm.Address, gFitTableContext.DiagnstAcm.Size, gFitTableContext.Dia= gnstAcmVersion); + } 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); } @@ -1957,6 +2011,7 @@ CHAR8 *mFitTypeStr[] =3D { " ", "MICROCODE ", "STARTUP_ACM", + "DIAGNST_ACM", " ", " ", " ", @@ -2525,6 +2580,18 @@ Returns: FitIndex++; } =20 + // + // 4.5. DiagnosticAcm + // + if (gFitTableContext.DiagnstAcm.Address !=3D 0) { + FitEntry[FitIndex].Address =3D gFitTableContext.DiagnstAcm= .Address; + *(UINT32 *)&FitEntry[FitIndex].Size[0] =3D 0; + FitEntry[FitIndex].Version =3D (UINT16)gFitTableContext.Di= agnstAcmVersion; + FitEntry[FitIndex].Type =3D FIT_TABLE_TYPE_DIAGNST_ACM; + FitEntry[FitIndex].C_V =3D 0; + FitEntry[FitIndex].Checksum =3D 0; + FitIndex++; + } // // 5. BiosModule // diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 4d0a2dc6f8..fdf535924c 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 58 +#define UTILITY_MINOR_VERSION 59 #define UTILITY_DATE __DATE__ =20 // --=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 (#54091): https://edk2.groups.io/g/devel/message/54091 Mute This Topic: https://groups.io/mt/71066754/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-