From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.5769.1666238267157300837 for ; Wed, 19 Oct 2022 20:57:47 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=Zgf3A2yu; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: pavamana.hv@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666238267; x=1697774267; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=31MGx3lpFsEIpdUBJdCzgBq9Txf/+r6DgbQw9GnuUXc=; b=Zgf3A2yuVTKaC7kmNkyRGvd3THQCdPF/7K9v48v0VPqCxGk2qkULoUOt N6pqSnirr/2CDyu2uVqIMtfIv5KQNz3lQtvcJitYfO7V/gcjP7sUp2pG7 zAqQ83AGy5tMrE8cWNd43DmkXmFCDt9FV1odnPdvLw1oq2k58u2Xi6xHj j1P6n7W7TNjSsyCzCxJnUeFMrxwW1yPjhvC/PKjPou1BQdUc+k8p6zYwr SlDE3osktKoe8I+MS+k8D1LQA3UAttyp9bgNTHzFVp8ow6RKrw5KkkaFS 32DZ8beRPS/X85Ued4A9+KwQaMZocECbmFvbL4W9YRK1bEB5a0elt0VTS A==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="392900685" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="392900685" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 20:57:46 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="580664786" X-IronPort-AV: E=Sophos;i="5.95,196,1661842800"; d="scan'208";a="580664786" Received: from phv-mobl.amr.corp.intel.com ([10.212.20.99]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Oct 2022 20:57:45 -0700 From: "Hv, Pavamana" To: devel@edk2.groups.io Cc: Pavamana Holavanahalli Subject: [PATCH v2] edk2Platforms-Silicon:Add VAB FIT record types support in FitGen.c Date: Wed, 19 Oct 2022 20:57:21 -0700 Message-Id: <3bbfe7d39637575ca8942493c7d70df111400f1c.1666228699.git.pavamana.hv@intel.com> X-Mailer: git-send-email 2.38.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4086 This commit adds support for new FIT record type for Vendor Authorized Boot (VAB) security technology(FIT spec revision 1.4). VAB defines 3 new following types Vendor Authorized Boot Provisioning Table (Type 0x1A) Vendor Authorized Boot Image Manifest (Type 0x1B) Vendor Authorized Boot Key Manifest (Type 0x1C) The code has been updated to align these binaries on 64 byte boundary and not to overlap with other regions, similar to Key manifest, Boot Policy manifest and other optional types. Also added macros to define FIT spec Major and Minor version numbers and print the same instead of hardcoded string. Signed-off-by: Pavamana Holavanahalli --- Silicon/Intel/Tools/FitGen/FitGen.c | 61 +++++++++++++++++++---------- Silicon/Intel/Tools/FitGen/FitGen.h | 5 ++- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/Silicon/Intel/Tools/FitGen/FitGen.c b/Silicon/Intel/Tools/FitG= en/FitGen.c index 21dfcf1ebb..87123f9922 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.c +++ b/Silicon/Intel/Tools/FitGen/FitGen.c @@ -234,20 +234,24 @@ typedef struct { #define FLASH_TO_MEMORY(Address, FvBuffer, FvSize) \=0D (VOID *)(UINTN)((UINTN)(FvBuffer) + (UINTN)(FvSize) - (TO= P_FLASH_ADDRESS - (UINTN)(Address)))=0D =0D -#define FIT_TABLE_TYPE_HEADER 0=0D -#define FIT_TABLE_TYPE_MICROCODE 1=0D -#define FIT_TABLE_TYPE_STARTUP_ACM 2=0D -#define FIT_TABLE_TYPE_DIAGNST_ACM 3=0D -#define FIT_TABLE_TYPE_BIOS_MODULE 7=0D -#define FIT_TABLE_TYPE_TPM_POLICY 8=0D -#define FIT_TABLE_TYPE_BIOS_POLICY 9=0D -#define FIT_TABLE_TYPE_TXT_POLICY 10=0D -#define FIT_TABLE_TYPE_KEY_MANIFEST 11=0D -#define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST 12=0D -#define FIT_TABLE_TYPE_BIOS_DATA_AREA 13=0D -#define FIT_TABLE_TYPE_CSE_SECURE_BOOT 16=0D -#define FIT_TABLE_SUBTYPE_FIT_PATCH_MANIFEST 12=0D -#define FIT_TABLE_SUBTYPE_ACM_MANIFEST 13=0D +#define FIT_TABLE_TYPE_HEADER 0=0D +#define FIT_TABLE_TYPE_MICROCODE 1=0D +#define FIT_TABLE_TYPE_STARTUP_ACM 2=0D +#define FIT_TABLE_TYPE_DIAGNST_ACM 3=0D +#define FIT_TABLE_TYPE_BIOS_MODULE 7=0D +#define FIT_TABLE_TYPE_TPM_POLICY 8=0D +#define FIT_TABLE_TYPE_BIOS_POLICY 9=0D +#define FIT_TABLE_TYPE_TXT_POLICY 10=0D +#define FIT_TABLE_TYPE_KEY_MANIFEST 11=0D +#define FIT_TABLE_TYPE_BOOT_POLICY_MANIFEST 12=0D +#define FIT_TABLE_TYPE_BIOS_DATA_AREA 13=0D +#define FIT_TABLE_TYPE_CSE_SECURE_BOOT 16=0D +#define FIT_TABLE_SUBTYPE_FIT_PATCH_MANIFEST 12=0D +#define FIT_TABLE_SUBTYPE_ACM_MANIFEST 13=0D +#define FIT_TABLE_TYPE_VAB_PROVISION_TABLE 26=0D +#define FIT_TABLE_TYPE_VAB_BOOT_IMAGE_MANIFEST 27=0D +#define FIT_TABLE_TYPE_VAB_BOOT_KEY_MANIFEST 28=0D +=0D =0D //=0D // With OptionalModule Address isn't known until free space has been=0D @@ -322,8 +326,10 @@ Returns: --*/=0D {=0D printf (=0D - "%s - Tiano IA32/X64 FIT table generation Utility for FIT spec revisio= n 1.2."" Version %i.%i\n\n",=0D + "%s - Tiano IA32/X64 FIT table generation Utility for FIT spec revisio= n %i.%i."" Version %i.%i\n\n",=0D UTILITY_NAME,=0D + FIT_SPEC_VERSION_MAJOR,=0D + FIT_SPEC_VERSION_MINOR,=0D UTILITY_MAJOR_VERSION,=0D UTILITY_MINOR_VERSION=0D );=0D @@ -1956,7 +1962,10 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT)) {=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_KEY_MANIFEST)) {=0D // NOTE: It might be virtual address now. Just put a place holder.=0D FitEntryNumber ++;=0D }=0D @@ -2154,8 +2163,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT)) {=0D - // Let it 64 byte align=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_KEY_MANIFEST)) {=0D + // Let it 64 byte align=0D AlignedSize +=3D BIOS_MODULE_ALIGNMENT;=0D AlignedSize &=3D ~BIOS_MODULE_ALIGNMENT;=0D }=0D @@ -2166,8 +2178,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT)) {=0D - // Let it 64 byte align=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TY= PE_VAB_BOOT_KEY_MANIFEST)) {=0D + // Let it 64 byte align=0D OptionalModuleAddress =3D (UINT8 *)((UINTN)OptionalModuleAddress &= ~BIOS_MODULE_ALIGNMENT);=0D }=0D =0D @@ -2201,7 +2216,11 @@ Returns: (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _KEY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BOOT_POLICY_MANIFEST) ||=0D (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _BIOS_DATA_AREA) ||=0D - (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT)) {=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _CSE_SECURE_BOOT) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_PROVISION_TABLE) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_IMAGE_MANIFEST) ||=0D + (gFitTableContext.OptionalModule[Index].Type =3D=3D FIT_TABLE_TYPE= _VAB_BOOT_KEY_MANIFEST)) {=0D +=0D CheckOverlap (gFitTableContext.OptionalModule[Index].Address, Aligne= dSize);=0D }=0D }=0D diff --git a/Silicon/Intel/Tools/FitGen/FitGen.h b/Silicon/Intel/Tools/FitG= en/FitGen.h index 80a1423ceb..511ab652ab 100644 --- a/Silicon/Intel/Tools/FitGen/FitGen.h +++ b/Silicon/Intel/Tools/FitGen/FitGen.h @@ -31,9 +31,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Utility version information=0D //=0D #define UTILITY_MAJOR_VERSION 0=0D -#define UTILITY_MINOR_VERSION 66=0D +#define UTILITY_MINOR_VERSION 67=0D #define UTILITY_DATE __DATE__=0D =0D +#define FIT_SPEC_VERSION_MAJOR 1=0D +#define FIT_SPEC_VERSION_MINOR 4=0D +=0D //=0D // The minimum number of arguments accepted from the command line.=0D //=0D --=20 2.26.2.windows.1