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.43; helo=mga05.intel.com; envelope-from=jian.j.wang@intel.com; receiver=edk2-devel@lists.01.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 842B42117D75A for ; Tue, 15 Jan 2019 00:05:54 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Jan 2019 00:05:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="135901123" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 15 Jan 2019 00:05:53 -0800 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 15 Jan 2019 00:05:48 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 15 Jan 2019 00:05:46 -0800 Received: from shsmsx107.ccr.corp.intel.com ([169.254.9.239]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.160]) with mapi id 14.03.0415.000; Tue, 15 Jan 2019 16:04:21 +0800 From: "Wang, Jian J" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Wu, Hao A" , Laszlo Ersek Thread-Topic: [PATCH V2 06/15] MdeModulePkg Variable: Remove CacheOffset in UpdateVariable() Thread-Index: AQHUrByrsck0vaPUT0qDbgl+MKXo+KWv+N+Q Date: Tue, 15 Jan 2019 08:04:21 +0000 Message-ID: References: <1547479196-40248-1-git-send-email-star.zeng@intel.com> <1547479196-40248-7-git-send-email-star.zeng@intel.com> In-Reply-To: <1547479196-40248-7-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQxNTk5N2UtNDgxNi00ZDI2LWE4M2EtZGFmNDY4YTE5ZGFjIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicGI3TXRQMG5CM056WENtR3RiUEVNV2NRdUU1K3RKQlRRXC9sa2JyajdmYldVenVneG9lN3Rmd05NUWJlTVlOVWwifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH V2 06/15] MdeModulePkg Variable: Remove CacheOffset in UpdateVariable() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Jan 2019 08:05:54 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Star, Just a tiny comment below. With it's addressed,=20 Reviewed-by: Jian J Wang > -----Original Message----- > From: Zeng, Star > Sent: Monday, January 14, 2019 11:20 PM > To: edk2-devel@lists.01.org > Cc: Zeng, Star ; Wang, Jian J ; > Wu, Hao A ; Laszlo Ersek > Subject: [PATCH V2 06/15] MdeModulePkg Variable: Remove CacheOffset in > UpdateVariable() >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1323 > Merge EmuVariable and Real variable driver. >=20 > CacheOffset could be removed in UpdateVariable() after > // > // update the memory copy of Flash region. > // > CopyMem ( > (UINT8 *)mNvVariableCache + CacheOffset, > (UINT8 *)NextVariable, VarSize > ); >=20 > is moved to be before mVariableModuleGlobal->NonVolatileLastVariableOffse= t > value is updated, like right before >=20 > mVariableModuleGlobal->NonVolatileLastVariableOffset +=3D > HEADER_ALIGN (VarSize); >=20 > This patch prepares for adding emulated variable NV mode > support in VariableRuntimeDxe. >=20 > Cc: Jian J Wang > Cc: Hao Wu > Cc: Laszlo Ersek > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Star Zeng > --- > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > index 424f92a53757..4d524db30fec 100644 > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > @@ -2139,7 +2139,6 @@ UpdateVariable ( > VARIABLE_POINTER_TRACK *Variable; > VARIABLE_POINTER_TRACK NvVariable; > VARIABLE_STORE_HEADER *VariableStoreHeader; > - UINTN CacheOffset; > UINT8 *BufferForMerge; > UINTN MergedBufSize; > BOOLEAN DataReady; > @@ -2577,7 +2576,6 @@ UpdateVariable ( > // > // Step 1: > // > - CacheOffset =3D mVariableModuleGlobal->NonVolatileLastVariableOffset= ; > Status =3D UpdateVariableStore ( > &mVariableModuleGlobal->VariableGlobal, > FALSE, > @@ -2643,6 +2641,11 @@ UpdateVariable ( > goto Done; > } >=20 > + // > + // update the memory copy of Flash region. > + // The first character of comment is not capitalized. > + CopyMem ((UINT8 *)mNvVariableCache + mVariableModuleGlobal- > >NonVolatileLastVariableOffset, (UINT8 *)NextVariable, VarSize); > + > mVariableModuleGlobal->NonVolatileLastVariableOffset +=3D HEADER_ALI= GN > (VarSize); >=20 > if ((Attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) !=3D 0) { > @@ -2653,10 +2656,6 @@ UpdateVariable ( > mVariableModuleGlobal->CommonUserVariableTotalSize +=3D > HEADER_ALIGN (VarSize); > } > } > - // > - // update the memory copy of Flash region. > - // > - CopyMem ((UINT8 *)mNvVariableCache + CacheOffset, (UINT8 > *)NextVariable, VarSize); > } else { > // > // Create a volatile variable. > -- > 2.7.0.windows.1