From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 6059A1A1E2B for ; Wed, 10 Aug 2016 05:26:24 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 10 Aug 2016 05:26:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,499,1464678000"; d="scan'208";a="746819415" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by FMSMGA003.fm.intel.com with ESMTP; 10 Aug 2016 05:26:24 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 10 Aug 2016 05:26:23 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 10 Aug 2016 05:26:23 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.147]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.107]) with mapi id 14.03.0248.002; Wed, 10 Aug 2016 20:26:21 +0800 From: "Gao, Liming" To: "Bi, Dandan" , "edk2-devel@lists.01.org" CC: "Dong, Eric" Thread-Topic: [PATCH v2 2/2] MdeModulePkg/Browser: Share default if some default value are not specified Thread-Index: AQHR8dzqh91riWaPn0aT/ZOL89Po9aBCIQNw Date: Wed, 10 Aug 2016 12:26:21 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A1155E979B@shsmsx102.ccr.corp.intel.com> References: <1470705898-99100-1-git-send-email-dandan.bi@intel.com> <1470705898-99100-3-git-send-email-dandan.bi@intel.com> In-Reply-To: <1470705898-99100-3-git-send-email-dandan.bi@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 v2 2/2] MdeModulePkg/Browser: Share default if some default value are not specified X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Aug 2016 12:26:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Bi, Dandan > Sent: Tuesday, August 09, 2016 9:25 AM > To: edk2-devel@lists.01.org > Cc: Gao, Liming ; Dong, Eric > Subject: [PATCH v2 2/2] MdeModulePkg/Browser: Share default if some > default value are not specified >=20 > Add a new implementation policy of getting default value in SetupBrowser. > The new policy is only for the situation that a question has default > value but doesn't have default value for all supported default type. > In this case, we will choose the smallest default id from the existing > defaults, and share its value to other default id which has no > default value. >=20 > Notes: > v1->V2: > Generate DefaultStoreList as ascending order directly instead > of using function GetDefaultIdArray(). >=20 > Cc: Liming Gao > Cc: Eric Dong > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Dandan Bi > --- > MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c | 25 > +++++++++++++++++++---- > MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 23 > ++++++++++++++++++++- > 2 files changed, 43 insertions(+), 5 deletions(-) >=20 > diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c > b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c > index 11a8fdc..61ba0b5 100644 > --- a/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c > +++ b/MdeModulePkg/Universal/SetupBrowserDxe/IfrParse.c > @@ -1,9 +1,9 @@ > /** @file > Parser for IFR binary encoding. >=20 > -Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > which accompanies this distribution. The full text of the license may b= e > found at > http://opensource.org/licenses/bsd-license.php >=20 > @@ -1309,10 +1309,13 @@ ParseOpCodes ( > EFI_VARSTORE_ID TempVarstoreId; > BOOLEAN InScopeDisable; > INTN ConditionalExprCount; > BOOLEAN InUnknownScope; > UINT8 UnknownDepth; > + FORMSET_DEFAULTSTORE *PreDefaultStore; > + LIST_ENTRY *DefaultLink; > + BOOLEAN HaveInserted; >=20 > SuppressForQuestion =3D FALSE; > SuppressForOption =3D FALSE; > InScopeDisable =3D FALSE; > DepthOfDisable =3D 0; > @@ -1873,21 +1876,35 @@ ParseOpCodes ( >=20 > // > // DefaultStore > // > case EFI_IFR_DEFAULTSTORE_OP: > + HaveInserted =3D FALSE; > DefaultStore =3D AllocateZeroPool (sizeof (FORMSET_DEFAULTSTORE)); > ASSERT (DefaultStore !=3D NULL); > DefaultStore->Signature =3D FORMSET_DEFAULTSTORE_SIGNATURE; >=20 > CopyMem (&DefaultStore->DefaultId, &((EFI_IFR_DEFAULTSTORE *) > OpCodeData)->DefaultId, sizeof (UINT16)); > CopyMem (&DefaultStore->DefaultName, &((EFI_IFR_DEFAULTSTORE *) > OpCodeData)->DefaultName, sizeof (EFI_STRING_ID)); > - > // > - // Insert to DefaultStore list of this Formset > + // Insert it to the DefaultStore list of this Formset with ascendi= ng order. > // > - InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->Lin= k); > + if (!IsListEmpty (&FormSet->DefaultStoreListHead)) { > + DefaultLink =3D GetFirstNode (&FormSet->DefaultStoreListHead); > + while (!IsNull (&FormSet->DefaultStoreListHead, DefaultLink)) { > + PreDefaultStore =3D > FORMSET_DEFAULTSTORE_FROM_LINK(DefaultLink); > + DefaultLink =3D GetNextNode (&FormSet->DefaultStoreListHead, > DefaultLink); > + if (DefaultStore->DefaultId < PreDefaultStore->DefaultId) { > + InsertTailList (&PreDefaultStore->Link, &DefaultStore->Link)= ; > + HaveInserted =3D TRUE; > + break; > + } > + } > + } > + if (!HaveInserted) { > + InsertTailList (&FormSet->DefaultStoreListHead, &DefaultStore->L= ink); > + } > break; >=20 > // > // Statements > // > diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c > b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c > index 6b38547..66c4313 100644 > --- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c > +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c > @@ -4048,13 +4048,18 @@ GetQuestionDefault ( > EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess; > EFI_BROWSER_ACTION_REQUEST ActionRequest; > INTN Action; > CHAR16 *NewString; > EFI_IFR_TYPE_VALUE *TypeValue; > + UINT16 OriginalDefaultId; > + FORMSET_DEFAULTSTORE *DefaultStore; > + LIST_ENTRY *DefaultLink; >=20 > Status =3D EFI_NOT_FOUND; > StrValue =3D NULL; > + OriginalDefaultId =3D DefaultId; > + DefaultLink =3D GetFirstNode (&FormSet->DefaultStoreListHead); >=20 > // > // Statement don't have storage, skip them > // > if (Question->QuestionId =3D=3D 0) { > @@ -4067,10 +4072,11 @@ GetQuestionDefault ( > // 2, use ExtractConfig function > // 3, use nested EFI_IFR_DEFAULT > // 4, set flags of EFI_ONE_OF_OPTION (provide Standard and > Manufacturing default) > // 5, set flags of EFI_IFR_CHECKBOX (provide Standard and Manufacturi= ng > default) (lowest priority) > // > +ReGetDefault: > HiiValue =3D &Question->HiiValue; > TypeValue =3D &HiiValue->Value; > if (HiiValue->Type =3D=3D EFI_IFR_TYPE_BUFFER) { > // > // For orderedlist, need to pass the BufferValue to Callback functio= n. > @@ -4233,11 +4239,26 @@ GetQuestionDefault ( > return EFI_SUCCESS; > } > } >=20 > // > - // For Questions without default > + // For question without default value for current default Id, we try t= o re- > get the default value form other default id in the DefaultStoreList. > + // If get, will exit the function, if not, will choose next default id= in the > DefaultStoreList. > + // The default id in DefaultStoreList are in ascending order to make s= ure > choose the smallest default id every time. > + // > + while (!IsNull(&FormSet->DefaultStoreListHead, DefaultLink)) { > + DefaultStore =3D FORMSET_DEFAULTSTORE_FROM_LINK(DefaultLink); > + DefaultLink =3D GetNextNode (&FormSet- > >DefaultStoreListHead,DefaultLink); > + DefaultId =3D DefaultStore->DefaultId; > + if (DefaultId =3D=3D OriginalDefaultId) { > + continue; > + } > + goto ReGetDefault; > + } > + > + // > + // For Questions without default value for all the default id in the > DefaultStoreList. > // > Status =3D EFI_NOT_FOUND; > switch (Question->Operand) { > case EFI_IFR_NUMERIC_OP: > // > -- > 1.9.5.msysgit.1