From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6704B20945BA0 for ; Mon, 25 Sep 2017 04:05:26 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2017 04:08:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,435,1500966000"; d="scan'208";a="139089386" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 25 Sep 2017 04:08:36 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 04:08:36 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 25 Sep 2017 04:08:36 -0700 Received: from shsmsx152.ccr.corp.intel.com ([169.254.6.93]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002; Mon, 25 Sep 2017 19:08:34 +0800 From: "Gao, Liming" To: "Zeng, Star" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2 Thread-Index: AQHTNecghhzaUP8AZke7dHeXA8q50qLFcW1A Date: Mon, 25 Sep 2017 11:08:33 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E15D0B1@SHSMSX152.ccr.corp.intel.com> References: <1506334473-56524-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1506334473-56524-1-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] IntelFrameworkModulePkg FwVolDxe: Support FFS_ATTRIB_DATA_ALIGNMENT_2 X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Sep 2017 11:05:26 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao >-----Original Message----- >From: Zeng, Star >Sent: Monday, September 25, 2017 6:15 PM >To: edk2-devel@lists.01.org >Cc: Zeng, Star ; Gao, Liming >Subject: [PATCH] IntelFrameworkModulePkg FwVolDxe: Support >FFS_ATTRIB_DATA_ALIGNMENT_2 > >Follow PI 1.6 spec to support FFS_ATTRIB_DATA_ALIGNMENT_2 for >FFS alignment extended to support maximum 16MB. > >Cc: Liming Gao >Contributed-under: TianoCore Contribution Agreement 1.1 >Signed-off-by: Star Zeng > >Note: This patch is to update IntelFrameworkModulePkg as a supplement >of https://lists.01.org/pipermail/edk2-devel/2017-September/015165.html. >--- > .../Universal/FirmwareVolume/FwVolDxe/FwVolRead.c | 37 >+++++++++++++------- > .../Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c | 39 >++++++++++++++++++++-- > 2 files changed, 62 insertions(+), 14 deletions(-) > >diff --git >a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolR >ead.c >b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Read.c >index 0d9021914f33..987c92c16be3 100644 >--- >a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolR >ead.c >+++ >b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Read.c >@@ -1,7 +1,7 @@ > /** @file > Implements functions to read firmware file. > >- Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
>+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions >@@ -17,18 +17,27 @@ > #include "FwVolDriver.h" > > /** >-Required Alignment Alignment Value in FFS Alignment V= alue in >-(bytes) Attributes Field Firmware Vo= lume Interfaces >-1 0 = 0 >-16 1 = 4 >-128 2 = 7 >-512 3 = 9 >-1 KB 4 = 10 >-4 KB 5 = 12 >-32 KB 6 = 15 >-64 KB 7 = 16 >+Required Alignment Alignment Value in FFS >FFS_ATTRIB_DATA_ALIGNMENT2 Alignment Value in >+(bytes) Attributes Field in FFS Attributes Field = Firmware Volume >Interfaces >+1 0 0 = 0 >+16 1 0 = 4 >+128 2 0 = 7 >+512 3 0 = 9 >+1 KB 4 0 = 10 >+4 KB 5 0 = 12 >+32 KB 6 0 = 15 >+64 KB 7 0 = 16 >+128 KB 0 1 = 17 >+256 KB 1 1 = 18 >+512 KB 2 1 = 19 >+1 MB 3 1 = 20 >+2 MB 4 1 = 21 >+4 MB 5 1 = 22 >+8 MB 6 1 = 23 >+16 MB 7 1 = 24 > **/ > UINT8 mFvAttributes[] =3D {0, 4, 7, 9, 10, 12, 15, 16}; >+UINT8 mFvAttributes2[] =3D {17, 18, 19, 20, 21, 22, 23, 24}; > > /** > Convert the FFS File Attributes to FV File Attributes. >@@ -49,7 +58,11 @@ FfsAttributes2FvFileAttributes ( > DataAlignment =3D (UINT8) ((FfsAttributes & >FFS_ATTRIB_DATA_ALIGNMENT) >> 3); > ASSERT (DataAlignment < 8); > >- FileAttribute =3D (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment]= ; >+ if ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT_2) !=3D 0) { >+ FileAttribute =3D (EFI_FV_FILE_ATTRIBUTES) mFvAttributes2[DataAlignme= nt]; >+ } else { >+ FileAttribute =3D (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignmen= t]; >+ } > > if ((FfsAttributes & FFS_ATTRIB_FIXED) =3D=3D FFS_ATTRIB_FIXED) { > FileAttribute |=3D EFI_FV_FILE_ATTRIB_FIXED; >diff --git >a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Write.c >b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Write.c >index 99385e0f579b..e95b75326c6e 100644 >--- >a/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Write.c >+++ >b/IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVol >Write.c >@@ -1,7 +1,7 @@ > /** @file > Implements write firmware file. > >- Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
>+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> > This program and the accompanying materials > are licensed and made available under the terms and conditions >@@ -202,9 +202,11 @@ FvFileAttrib2FfsFileAttrib ( > { > UINT8 FvFileAlignment; > UINT8 FfsFileAlignment; >+ UINT8 FfsFileAlignment2; > > FvFileAlignment =3D (UINT8) (FvFileAttrib & >EFI_FV_FILE_ATTRIB_ALIGNMENT); > FfsFileAlignment =3D 0; >+ FfsFileAlignment2 =3D 0; > > switch (FvFileAlignment) { > case 0: >@@ -289,9 +291,42 @@ FvFileAttrib2FfsFileAttrib ( > case 16: > FfsFileAlignment =3D 7; > break; >+ >+ case 17: >+ FfsFileAlignment =3D 0; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 18: >+ FfsFileAlignment =3D 1; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 19: >+ FfsFileAlignment =3D 2; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 20: >+ FfsFileAlignment =3D 3; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 21: >+ FfsFileAlignment =3D 4; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 22: >+ FfsFileAlignment =3D 5; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 23: >+ FfsFileAlignment =3D 6; >+ FfsFileAlignment2 =3D 1; >+ break; >+ case 24: >+ FfsFileAlignment =3D 7; >+ FfsFileAlignment2 =3D 1; >+ break; > } > >- *FfsFileAttrib =3D (UINT8) (FfsFileAlignment << 3); >+ *FfsFileAttrib =3D (UINT8) ((FfsFileAlignment << 3) | (FfsFileAlignment= 2 << 1)); > > return ; > } >-- >2.7.0.windows.1