From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id E6A057803D8 for ; Thu, 22 Aug 2024 08:14:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=E4z0g3eCLPjpddawWFjwkgysb1fmFx4s95ik4/eXrd0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1724314489; v=1; b=4wq2sQ4rU2M/6fj/sUjIPZz7F+OzlD3orcJ2tKmXKWIIhx9He9zrrI3ooMB7MJhyd+dqi4Zo f7XgVaZBgP3OQgkL00vhzYu0trqUCm5FIhQfnYVHXyZ40MnDt+fMdersmp7EtccjOZHVAkE06UU 7IOOX0BxmQcAO+c3pfrQjTgUn301nqh0BSPX/r4VcGIdX/GD1QAeZnGXrE6ib6Mh4HPc5Wa0znq SIoRrsofpF8uEjLd1CPOZVZIRq9dcMiydO8QkQNLrfV0U8eaHJbtdWI2DeiLGzrZVIX+Peqi8HB YXMbnTDmTNLTSqOypt1lmQqed4VP1A/QRiLTKR1Gtvz/g== X-Received: by 127.0.0.2 with SMTP id vuMGYY7687511x6np0jqjxao; Thu, 22 Aug 2024 01:14:48 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mx.groups.io with SMTP id smtpd.web10.8676.1724314487370076901 for ; Thu, 22 Aug 2024 01:14:47 -0700 X-CSE-ConnectionGUID: aWEXcbLHR0Clptq4aqdB2A== X-CSE-MsgGUID: Ohe6NG6/Ram266cHuy/8FQ== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="33331886" X-IronPort-AV: E=Sophos;i="6.10,166,1719903600"; d="scan'208";a="33331886" X-Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 01:14:47 -0700 X-CSE-ConnectionGUID: zZLMo1u2Q5GTt2z/xBiv+w== X-CSE-MsgGUID: us3VDKsERmSWSftKsp1LVg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,166,1719903600"; d="scan'208";a="65714728" X-Received: from liencx-desk.gar.corp.intel.com ([10.225.34.86]) by fmviesa005.fm.intel.com with ESMTP; 22 Aug 2024 01:14:45 -0700 From: "Lien, HoraceX" To: devel@edk2.groups.io Cc: HoraceX Lien , Yuwei Chen , Feng Bob C , Liming Gao Subject: =?UTF-8?B?W2VkazItZGV2ZWxdIFtQQVRDSF0gU2lsaWNvbi9JbnRlbC9GaXRHZW7vvJpGSVQgY2hhbmdlIGZvciBNTUMgZW50cnku?= Date: Thu, 22 Aug 2024 16:14:40 +0800 Message-ID: <20240822081440.1262-1-horacex.lien@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 22 Aug 2024 01:14:47 -0700 Resent-From: horacex.lien@intel.com Reply-To: devel@edk2.groups.io,horacex.lien@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: f27bppMY9UcJp2EV0g6MUUJix7686176AA= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=4wq2sQ4r; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io From: HoraceX Lien REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4828 Support Type5 for Memory Microcontroller Firmware Image entry. Signed-off-by: HoraceX Lien Cc: Yuwei Chen Cc: Feng Bob C Cc: Liming Gao --- Silicon/Intel/Tools/FitGen/FitGen.c | 56 +++++++++++++++++++- Silicon/Intel/Tools/FitGen/FitGen.h | 2 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 055ffd4c..10592ac8 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -267,6 +267,8 @@ typedef struct { #define DEFAULT_FIT_ENTRY_VERSION 0x0100 #define STARTUP_ACM_FIT_ENTRY_200_VERSION 0x0200 =20 +#define MAX_MMCFW_MODULE_ENTRY 0x02 + #define TOP_FLASH_ADDRESS (gFitTableContext.TopFlashAddressRemapValue) =20 #define MEMORY_TO_FLASH(FileBuffer, FvBuffer, FvSize) \ @@ -279,6 +281,7 @@ typedef struct { #define FIT_TABLE_TYPE_STARTUP_ACM 2 #define FIT_TABLE_TYPE_DIAGNST_ACM 3 #define FIT_TABLE_TYPE_PROT_BOOT_POLICY 4 +#define FIT_TABLE_TYPE_MMC_FW 5 #define FIT_TABLE_TYPE_BIOS_MODULE 7 #define FIT_TABLE_TYPE_TPM_POLICY 8 #define FIT_TABLE_TYPE_BIOS_POLICY 9 @@ -318,6 +321,7 @@ typedef struct { UINT32 FitEntryNumber; UINT32 BiosModuleNumber; UINT32 MicrocodeNumber; + UINT32 MmcFwNumber; UINT32 StartupAcmNumber; UINT32 OptionalModuleNumber; UINT32 PortModuleNumber; @@ -336,6 +340,7 @@ typedef struct { UINT32 MicrocodeVersion; FIT_TABLE_CONTEXT_ENTRY OptionalModule[MAX_OPTIONAL_ENTRY]; FIT_TABLE_CONTEXT_ENTRY PortModule[MAX_PORT_ENTRY]; + FIT_TABLE_CONTEXT_ENTRY MmcFw[MAX_MMCFW_MODULE_ENTRY]; UINT64 TopFlashAddressRemapValue; } FIT_TABLE_CONTEXT; =20 @@ -1044,6 +1049,10 @@ GetFitEntryNumber ( UINT32 MicrocodeRegionOffset; UINT32 MicrocodeRegionSize; UINT32 SlotSize; + UINT32 MMCRegionOffset; + UINT8 *MMCBuffer; + UINT8 *MMCFileBuffer; + EFI_FIRMWARE_VOLUME_HEADER *MMCFvHeader; STATUS Status; EFI_FIRMWARE_VOLUME_HEADER *FvHeader; UINTN FitEntryNumber; @@ -1303,6 +1312,29 @@ GetFitEntryNumber ( gFitTableContext.ProtBootPolicy.Version =3D DEFAULT_FIT_ENTRY_V= ERSION; gFitTableContext.FitEntryNumber ++; break; + case FIT_TABLE_TYPE_MMC_FW: + if (gFitTableContext.MmcFwNumber >=3D MAX_MMCFW_MODULE_ENTRY) { + Error (NULL, 0, 0, "-I Parameter incorrect, Too many Bios Mmc = Fw!", NULL); + return 0; + } + MMCRegionOffset =3D (UINT32)BiosInfoStruct[BiosInfoIndex].Addres= s; + if (MMCRegionOffset =3D=3D 0) { + continue; + } + MMCBuffer =3D FLASH_TO_MEMORY (MMCRegionOffset, FdBuffer, FdSize= ); + MMCFvHeader =3D (EFI_FIRMWARE_VOLUME_HEADER *)MMCBuffer; + if (MMCFvHeader->Signature =3D=3D EFI_FVH_SIGNATURE) { + MMCFileBuffer =3D GetMicrocodeBufferFromFv (MMCFvHeader); + } else { + MMCFileBuffer =3D MMCBuffer; + } + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Type = =3D BiosInfoStruct[BiosInfoIndex].Type; + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Address = =3D (UINT32)BiosInfoStruct[BiosInfoIndex].Address + (UINT32)((UINTN) MMCFil= eBuffer - (UINTN) MMCBuffer); + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Size = =3D (UINT32)BiosInfoStruct[BiosInfoIndex].Size; + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Version = =3D DEFAULT_FIT_ENTRY_VERSION; + gFitTableContext.MmcFwNumber++; + gFitTableContext.FitEntryNumber++; + break; case FIT_TABLE_TYPE_BIOS_MODULE: if ((BiosInfoStruct[BiosInfoIndex].Attributes & BIOS_INFO_STRUCT= _ATTRIBUTE_BIOS_POST_IBB) !=3D 0) { continue; @@ -2413,6 +2445,9 @@ PrintFitData ( for (Index =3D 0; Index < gFitTableContext.MicrocodeNumber; Index++) { printf ("Microcode[%d] - (0x%08x, 0x%08x, 0x%04x)\n", Index, gFitTable= Context.Microcode[Index].Address, gFitTableContext.Microcode[Index].Size, g= FitTableContext.MicrocodeVersion); } + for (Index =3D 0; Index < gFitTableContext.MmcFwNumber; Index++) { + printf ("MmcFw[%d] - (0x%08x, 0x%08x)\n", Index, gFitTableContext.MmcF= w[Index].Address, gFitTableContext.MmcFw[Index].Size); + } for (Index =3D 0; Index < gFitTableContext.OptionalModuleNumber; Index++= ) { printf ("OptionalModule[%d] - (0x%08x, 0x%08x, 0x%02x, 0x%04x)\n", Ind= ex, gFitTableContext.OptionalModule[Index].Address, gFitTableContext.Option= alModule[Index].Size, gFitTableContext.OptionalModule[Index].Type, gFitTabl= eContext.OptionalModule[Index].Version); } @@ -2450,7 +2485,7 @@ CHAR8 *mFitTypeStr[] =3D { "STARTUP_ACM", "DIAGNST_ACM", "BOOT_POLICY", - " ", + "MMCFW ", " ", "BIOS_MODULE", "TPM_POLICY ", @@ -3096,6 +3131,20 @@ FillFitTable ( FitIndex++; } =20 + for (Index =3D 0; Index < gFitTableContext.MmcFwNumber; Index++) { + FitEntrySizeValue =3D 0; // gFitTableContext.MMCVersion.Size= / 16 + FitEntry[FitIndex].Address =3D gFitTableContext.MmcFw[Index].Address; + FitEntry[FitIndex].Size[0] =3D (UINT8)FitEntrySizeValue; + FitEntry[FitIndex].Size[1] =3D (UINT8)(FitEntrySizeValue >> 8); + FitEntry[FitIndex].Size[2] =3D (UINT8)(FitEntrySizeValue >> 16); + FitEntry[FitIndex].Rsvd =3D 0; + FitEntry[FitIndex].Version =3D (UINT16)gFitTableContext.MmcFw[Index].= Version; + FitEntry[FitIndex].Type =3D 0x5; + FitEntry[FitIndex].C_V =3D 0; + FitEntry[FitIndex].Checksum =3D 0; + FitIndex++; + } + // // 4.5. DiagnosticAcm // @@ -3578,6 +3627,11 @@ GetFitEntryInfo ( gFitTableContext.ProtBootPolicy.Version =3D FitEntry[FitIndex].Versi= on; gFitTableContext.ProtBootPolicy.Size =3D GetFirmwareInterfaceTableEn= trySize (&FitEntry[FitIndex]); break; + case FIT_TABLE_TYPE_MMC_FW: + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Address =3D (UI= NT32)FitEntry[FitIndex].Address; + gFitTableContext.MmcFw[gFitTableContext.MmcFwNumber].Version =3D Fit= Entry[FitIndex].Version; + gFitTableContext.MmcFwNumber++; + break; case FIT_TABLE_TYPE_BIOS_MODULE: gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Addre= ss =3D (UINT32)FitEntry[FitIndex].Address; gFitTableContext.BiosModule[gFitTableContext.BiosModuleNumber].Size = =3D FitEntrySizeValue * 16; diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 2d24ecb5..dd64c379 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -35,7 +35,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define UTILITY_DATE __DATE__ =20 #define FIT_SPEC_VERSION_MAJOR 1 -#define FIT_SPEC_VERSION_MINOR 4 +#define FIT_SPEC_VERSION_MINOR 5 // // The minimum number of arguments accepted from the command line. // --=20 2.43.0.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 (#120392): https://edk2.groups.io/g/devel/message/120392 Mute This Topic: https://groups.io/mt/108034749/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-