From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: hao.a.wu@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Mon, 07 Oct 2019 19:12:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Oct 2019 19:12:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,269,1566889200"; d="scan'208";a="183609854" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga007.jf.intel.com with ESMTP; 07 Oct 2019 19:12:13 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 7 Oct 2019 19:12:03 -0700 Received: from shsmsx154.ccr.corp.intel.com (10.239.6.54) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 7 Oct 2019 19:12:02 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.166]) by SHSMSX154.ccr.corp.intel.com ([10.239.6.54]) with mapi id 14.03.0439.000; Tue, 8 Oct 2019 10:11:59 +0800 From: "Wu, Hao A" To: "devel@edk2.groups.io" , "Kubacki, Michael A" CC: "Bi, Dandan" , Ard Biesheuvel , "Dong, Eric" , Laszlo Ersek , "Gao, Liming" , "Kinney, Michael D" , "Ni, Ray" , "Wang, Jian J" , "Yao, Jiewen" Subject: Re: [edk2-devel] [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize VARIABLE_INFO_ENTRY buffer Thread-Topic: [edk2-devel] [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize VARIABLE_INFO_ENTRY buffer Thread-Index: AQHVdZ61sWwVTyB4eUeIO+dh4/6Kh6dCNuWQgAcIC7CABsar4A== Date: Tue, 8 Oct 2019 02:11:59 +0000 Message-ID: References: <20190928014717.31372-1-michael.a.kubacki@intel.com> <20190928014717.31372-4-michael.a.kubacki@intel.com> In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Kubacki, Michael A > Sent: Friday, October 04, 2019 2:06 AM > To: Wu, Hao A; devel@edk2.groups.io > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Liming; K= inney, > Michael D; Ni, Ray; Wang, Jian J; Yao, Jiewen > Subject: Re: [edk2-devel] [PATCH V2 3/9] MdeModulePkg/Variable: > Parameterize VARIABLE_INFO_ENTRY buffer >=20 > Your understanding is correct. Thanks for the confirmation. Could you help to refine the commit message in the next series? Thanks. Best Regards, Hao Wu >=20 > Thanks, > Michael >=20 > > -----Original Message----- > > From: Wu, Hao A > > Sent: Thursday, October 3, 2019 1:04 AM > > To: Kubacki, Michael A ; > > devel@edk2.groups.io > > Cc: Bi, Dandan ; Ard Biesheuvel > > ; Dong, Eric ; Laszlo > Ersek > > ; Gao, Liming ; Kinney, > Michael > > D ; Ni, Ray ; Wang, Jian= J > > ; Yao, Jiewen > > Subject: RE: [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize > > VARIABLE_INFO_ENTRY buffer > > > > > -----Original Message----- > > > From: Kubacki, Michael A > > > Sent: Saturday, September 28, 2019 9:47 AM > > > To: devel@edk2.groups.io > > > Cc: Bi, Dandan; Ard Biesheuvel; Dong, Eric; Laszlo Ersek; Gao, Limin= g; > > > Kinney, Michael D; Ni, Ray; Wang, Jian J; Wu, Hao A; Yao, Jiewen > > > Subject: [PATCH V2 3/9] MdeModulePkg/Variable: Parameterize > > > VARIABLE_INFO_ENTRY buffer > > > > > > UpdateVariableInfo () currently accepts parameters regarding updates > > > to be made to a global variable of type VARIABLE_INFO_ENTRY. This > > > change passes the structure by pointer to UpdateVariableInfo () so > > > structures can be updated outside the fixed global variable. > > > > > > For: > > "... so structures can be updated outside the fixed global variable " > > > > Do you mean: > > > > VARIABLE_INFO_ENTRY structure pointers other than "&gVariableInfo" can > > be passed to UpdateVariableInfo(). > > > > Is my understanding correct? If so, > > Reviewed-by: Hao A Wu > > > > Best Regards, > > Hao Wu > > > > > > > > > > Cc: Dandan Bi > > > Cc: Ard Biesheuvel > > > Cc: Eric Dong > > > Cc: Laszlo Ersek > > > Cc: Liming Gao > > > Cc: Michael D Kinney > > > Cc: Ray Ni > > > Cc: Jian J Wang > > > Cc: Hao A Wu > > > Cc: Jiewen Yao > > > Signed-off-by: Michael Kubacki > > > --- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h | 18 > > > +++++---- > > > MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c | 14 > +++--- > > - > > > MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c | 41 > > > +++++++++++--------- > > > 3 files changed, 39 insertions(+), 34 deletions(-) > > > > > > diff --git > > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > index 0d231511ea..6f2000f3ee 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.h > > > @@ -286,13 +286,14 @@ GetNextVariableEx ( > > > the transaction. Data is allocated by this routine, but never > > > freed. > > > > > > - @param[in] VariableName Name of the Variable to track. > > > - @param[in] VendorGuid Guid of the Variable to track. > > > - @param[in] Volatile TRUE if volatile FALSE if non-volatile. > > > - @param[in] Read TRUE if GetVariable() was called. > > > - @param[in] Write TRUE if SetVariable() was called. > > > - @param[in] Delete TRUE if deleted via SetVariable(). > > > - @param[in] Cache TRUE for a cache hit. > > > + @param[in] VariableName Name of the Variable to track. > > > + @param[in] VendorGuid Guid of the Variable to track. > > > + @param[in] Volatile TRUE if volatile FALSE if non-vola= tile. > > > + @param[in] Read TRUE if GetVariable() was called. > > > + @param[in] Write TRUE if SetVariable() was called. > > > + @param[in] Delete TRUE if deleted via SetVariable(). > > > + @param[in] Cache TRUE for a cache hit. > > > + @param[in,out] VariableInfo Pointer to a pointer of > > > VARIABLE_INFO_ENTRY structures. > > > > > > **/ > > > VOID > > > @@ -303,7 +304,8 @@ UpdateVariableInfo ( > > > IN BOOLEAN Read, > > > IN BOOLEAN Write, > > > IN BOOLEAN Delete, > > > - IN BOOLEAN Cache > > > + IN BOOLEAN Cache, > > > + IN OUT VARIABLE_INFO_ENTRY **VariableInfo > > > ); > > > > > > #endif > > > diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > index 816e8f7b8f..1a57d7e1ba 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c > > > @@ -1641,7 +1641,7 @@ UpdateVariable ( > > > // go to delete this variable in variable HOB and > > > // try to flush other variables from HOB to flash. > > > // > > > - UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE, > > FALSE, > > > TRUE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE, > > > + FALSE, > > > TRUE, FALSE, &gVariableInfo); > > > FlushHobVariableToFlash (VariableName, VendorGuid); > > > return EFI_SUCCESS; > > > } > > > @@ -1758,7 +1758,7 @@ UpdateVariable ( > > > &State > > > ); > > > if (!EFI_ERROR (Status)) { > > > - UpdateVariableInfo (VariableName, VendorGuid, Variable->Vol= atile, > > > FALSE, FALSE, TRUE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, > > > + Variable->Volatile, > > > FALSE, FALSE, TRUE, FALSE, &gVariableInfo); > > > if (!Variable->Volatile) { > > > CacheVariable->CurrPtr->State =3D State; > > > FlushHobVariableToFlash (VariableName, VendorGuid); @@ > > > -1777,7 +1777,7 @@ UpdateVariable ( > > > // > > > // Variable content unchanged and no need to update timestamp= , > > > just return. > > > // > > > - UpdateVariableInfo (VariableName, VendorGuid, Variable->Volat= ile, > > > FALSE, TRUE, FALSE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, > > > + Variable->Volatile, > > > FALSE, TRUE, FALSE, FALSE, &gVariableInfo); > > > Status =3D EFI_SUCCESS; > > > goto Done; > > > } else if ((CacheVariable->CurrPtr->State =3D=3D VAR_ADDED) || = @@ > > > -2006,7 +2006,7 @@ UpdateVariable ( > > > CacheVariable->CurrPtr =3D (VARIABLE_HEADER *)((UINTN) > > > CacheVariable->StartPtr + ((UINTN) Variable->CurrPtr - (UINTN) > > > CacheVariable->Variable- > > > >StartPtr)); > > > CacheVariable->InDeletedTransitionPtr =3D NULL; > > > } > > > - UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE, > TRUE, > > > FALSE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, FALSE, FALSE, > > > + TRUE, > > > FALSE, FALSE, &gVariableInfo); > > > FlushHobVariableToFlash (VariableName, VendorGuid); > > > } else { > > > if (IsCommonUserVariable && ((VarSize + > > > mVariableModuleGlobal- > > > >CommonUserVariableTotalSize) > mVariableModuleGlobal- > > > >CommonMaxUserVariableSpace)) { > > > @@ -2156,7 +2156,7 @@ UpdateVariable ( > > > CacheVariable->CurrPtr =3D (VARIABLE_HEADER *)((UINTN) > > > CacheVariable->StartPtr + ((UINTN) Variable->CurrPtr - (UINTN) > > > CacheVariable->Variable- > > > >StartPtr)); > > > CacheVariable->InDeletedTransitionPtr =3D NULL; > > > } > > > - UpdateVariableInfo (VariableName, VendorGuid, TRUE, FALSE, = TRUE, > > > FALSE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, TRUE, FALSE, > > > + TRUE, > > > FALSE, FALSE, &gVariableInfo); > > > } > > > goto Done; > > > } > > > @@ -2227,7 +2227,7 @@ UpdateVariable ( > > > } > > > > > > if (!EFI_ERROR (Status)) { > > > - UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, > TRUE, > > > FALSE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, Volatile, FALSE, > > > + TRUE, > > > FALSE, FALSE, &gVariableInfo); > > > if (!Volatile) { > > > FlushHobVariableToFlash (VariableName, VendorGuid); > > > } > > > @@ -2306,7 +2306,7 @@ VariableServiceGetVariable ( > > > } > > > > > > *DataSize =3D VarDataSize; > > > - UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile= , > > TRUE, > > > FALSE, FALSE, FALSE); > > > + UpdateVariableInfo (VariableName, VendorGuid, Variable.Volatile= , > > > + TRUE, > > > FALSE, FALSE, FALSE, &gVariableInfo); > > > > > > Status =3D EFI_SUCCESS; > > > goto Done; > > > diff --git > > > a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > index 9bc5369a90..394195342d 100644 > > > --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > +++ > b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableParsing.c > > > @@ -660,13 +660,14 @@ Done: > > > the transaction. Data is allocated by this routine, but never > > > freed. > > > > > > - @param[in] VariableName Name of the Variable to track. > > > - @param[in] VendorGuid Guid of the Variable to track. > > > - @param[in] Volatile TRUE if volatile FALSE if non-volatile. > > > - @param[in] Read TRUE if GetVariable() was called. > > > - @param[in] Write TRUE if SetVariable() was called. > > > - @param[in] Delete TRUE if deleted via SetVariable(). > > > - @param[in] Cache TRUE for a cache hit. > > > + @param[in] VariableName Name of the Variable to track. > > > + @param[in] VendorGuid Guid of the Variable to track. > > > + @param[in] Volatile TRUE if volatile FALSE if non-vola= tile. > > > + @param[in] Read TRUE if GetVariable() was called. > > > + @param[in] Write TRUE if SetVariable() was called. > > > + @param[in] Delete TRUE if deleted via SetVariable(). > > > + @param[in] Cache TRUE for a cache hit. > > > + @param[in,out] VariableInfo Pointer to a pointer of > > > VARIABLE_INFO_ENTRY structures. > > > > > > **/ > > > VOID > > > @@ -677,35 +678,38 @@ UpdateVariableInfo ( > > > IN BOOLEAN Read, > > > IN BOOLEAN Write, > > > IN BOOLEAN Delete, > > > - IN BOOLEAN Cache > > > + IN BOOLEAN Cache, > > > + IN OUT VARIABLE_INFO_ENTRY **VariableInfo > > > ) > > > { > > > VARIABLE_INFO_ENTRY *Entry; > > > > > > if (FeaturePcdGet (PcdVariableCollectStatistics)) { > > > - > > > + if (VariableName =3D=3D NULL || VendorGuid =3D=3D NULL || Varia= bleInfo =3D=3D > > > NULL) { > > > + return; > > > + } > > > if (AtRuntime ()) { > > > // Don't collect statistics at runtime. > > > return; > > > } > > > > > > - if (gVariableInfo =3D=3D NULL) { > > > + if (*VariableInfo =3D=3D NULL) { > > > // > > > // On the first call allocate a entry and place a pointer to = it in > > > // the EFI System Table. > > > // > > > - gVariableInfo =3D AllocateZeroPool (sizeof (VARIABLE_INFO_ENT= RY)); > > > - ASSERT (gVariableInfo !=3D NULL); > > > + *VariableInfo =3D AllocateZeroPool (sizeof (VARIABLE_INFO_ENT= RY)); > > > + ASSERT (*VariableInfo !=3D NULL); > > > > > > - CopyGuid (&gVariableInfo->VendorGuid, VendorGuid); > > > - gVariableInfo->Name =3D AllocateZeroPool (StrSize (VariableNa= me)); > > > - ASSERT (gVariableInfo->Name !=3D NULL); > > > - StrCpyS (gVariableInfo->Name, > StrSize(VariableName)/sizeof(CHAR16), > > > VariableName); > > > - gVariableInfo->Volatile =3D Volatile; > > > + CopyGuid (&(*VariableInfo)->VendorGuid, VendorGuid); > > > + (*VariableInfo)->Name =3D AllocateZeroPool (StrSize (Variable= Name)); > > > + ASSERT ((*VariableInfo)->Name !=3D NULL); > > > + StrCpyS ((*VariableInfo)->Name, > > > + StrSize(VariableName)/sizeof(CHAR16), > > > VariableName); > > > + (*VariableInfo)->Volatile =3D Volatile; > > > } > > > > > > > > > - for (Entry =3D gVariableInfo; Entry !=3D NULL; Entry =3D Entry-= >Next) { > > > + for (Entry =3D (*VariableInfo); Entry !=3D NULL; Entry =3D Entr= y->Next) > > > + { > > > if (CompareGuid (VendorGuid, &Entry->VendorGuid)) { > > > if (StrCmp (VariableName, Entry->Name) =3D=3D 0) { > > > if (Read) { > > > @@ -739,7 +743,6 @@ UpdateVariableInfo ( > > > StrCpyS (Entry->Next->Name, > > > StrSize(VariableName)/sizeof(CHAR16), > > > VariableName); > > > Entry->Next->Volatile =3D Volatile; > > > } > > > - > > > } > > > } > > > } > > > -- > > > 2.16.2.windows.1 > > >=20 >=20 >=20